forked from OSchip/llvm-project
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:
parent
5f075827bf
commit
e4c566c604
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue