[cfe-commits] r40420 - /cfe/trunk/Driver/PrintPreprocessedOutput.cpp
Chris Lattner
sabre at nondot.org
Sun Jul 22 22:18:42 PDT 2007
Author: lattner
Date: Mon Jul 23 00:18:42 2007
New Revision: 40420
URL: http://llvm.org/viewvc/llvm-project?rev=40420&view=rev
Log:
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%
Modified:
cfe/trunk/Driver/PrintPreprocessedOutput.cpp
Modified: cfe/trunk/Driver/PrintPreprocessedOutput.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/PrintPreprocessedOutput.cpp?rev=40420&r1=40419&r2=40420&view=diff
==============================================================================
--- cfe/trunk/Driver/PrintPreprocessedOutput.cpp (original)
+++ cfe/trunk/Driver/PrintPreprocessedOutput.cpp Mon Jul 23 00:18:42 2007
@@ -332,6 +332,10 @@
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);
More information about the cfe-commits
mailing list