If a token doesn't need cleaning, we can get its first character

without having to get the whole token.  This speeds up -E on 
447.dealII by 1.8%

llvm-svn: 40420
This commit is contained in:
Chris Lattner 2007-07-23 05:18:42 +00:00
parent 5f075827bf
commit e4c566c604
1 changed files with 4 additions and 0 deletions

View File

@ -332,6 +332,10 @@ bool PrintPPOutputPPCallbacks::AvoidConcat(const Token &PrevTok,
if (IdentifierInfo *II = Tok.getIdentifierInfo()) {
// Avoid spelling identifiers, the most common form of token.
FirstChar = II->getName()[0];
} else if (!Tok.needsCleaning()) {
SourceManager &SrcMgr = PP.getSourceManager();
FirstChar =
*SrcMgr.getCharacterData(SrcMgr.getPhysicalLoc(Tok.getLocation()));
} else if (Tok.getLength() < 256) {
const char *TokPtr = Buffer;
PP.getSpelling(Tok, TokPtr);