Avoid calling getSpelling at all for identifiers, which are

trivial to handle and very very common.  This speeds up -E on 
447.dealII by 2.5%

llvm-svn: 40422
This commit is contained in:
Chris Lattner 2007-07-23 06:14:36 +00:00
parent 4418ce1091
commit 0af9823e4d
1 changed files with 5 additions and 1 deletions

View File

@ -517,7 +517,11 @@ void clang::DoPrintPreprocessedInput(unsigned MainFileID, Preprocessor &PP,
OutputChar(' ');
}
if (Tok.getLength() < 256) {
if (IdentifierInfo *II = Tok.getIdentifierInfo()) {
const char *Str = II->getName();
unsigned Len = Tok.needsCleaning() ? strlen(Str) : Tok.getLength();
OutputString(Str, Len);
} else if (Tok.getLength() < 256) {
const char *TokPtr = Buffer;
unsigned Len = PP.getSpelling(Tok, TokPtr);
OutputString(TokPtr, Len);