[cfe-commits] r40422 - /cfe/trunk/Driver/PrintPreprocessedOutput.cpp

Chris Lattner sabre at nondot.org
Sun Jul 22 23:14:37 PDT 2007


Author: lattner
Date: Mon Jul 23 01:14:36 2007
New Revision: 40422

URL: http://llvm.org/viewvc/llvm-project?rev=40422&view=rev
Log:
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%

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=40422&r1=40421&r2=40422&view=diff

==============================================================================
--- cfe/trunk/Driver/PrintPreprocessedOutput.cpp (original)
+++ cfe/trunk/Driver/PrintPreprocessedOutput.cpp Mon Jul 23 01:14:36 2007
@@ -517,7 +517,11 @@
       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);





More information about the cfe-commits mailing list