[cfe-commits] r63029 - /cfe/trunk/Driver/PrintPreprocessedOutput.cpp
Chris Lattner
sabre at nondot.org
Mon Jan 26 11:33:54 PST 2009
Author: lattner
Date: Mon Jan 26 13:33:54 2009
New Revision: 63029
URL: http://llvm.org/viewvc/llvm-project?rev=63029&view=rev
Log:
minor speedups/cleanups for -E mode.
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=63029&r1=63028&r2=63029&view=diff
==============================================================================
--- cfe/trunk/Driver/PrintPreprocessedOutput.cpp (original)
+++ cfe/trunk/Driver/PrintPreprocessedOutput.cpp Mon Jan 26 13:33:54 2009
@@ -430,10 +430,13 @@
// Avoid spelling identifiers, the most common form of token.
FirstChar = II->getName()[0];
} else if (!Tok.needsCleaning()) {
- // FIXME: SPEED UP LITERALS!
- SourceManager &SrcMgr = PP.getSourceManager();
- FirstChar =
- *SrcMgr.getCharacterData(SrcMgr.getSpellingLoc(Tok.getLocation()));
+ if (Tok.isLiteral() && Tok.getLiteralData()) {
+ FirstChar = *Tok.getLiteralData();
+ } else {
+ SourceManager &SrcMgr = PP.getSourceManager();
+ FirstChar =
+ *SrcMgr.getCharacterData(SrcMgr.getSpellingLoc(Tok.getLocation()));
+ }
} else if (Tok.getLength() < 256) {
const char *TokPtr = Buffer;
PP.getSpelling(Tok, TokPtr);
@@ -554,10 +557,10 @@
}
if (IdentifierInfo *II = Tok.getIdentifierInfo()) {
- const char *Str = II->getName();
- unsigned Len = Tok.needsCleaning() ? strlen(Str) : Tok.getLength();
- OS.write(Str, Len);
- // FIXME: ACCELERATE LITERALS
+ OS.write(II->getName(), II->getLength());
+ } else if (Tok.isLiteral() && !Tok.needsCleaning() &&
+ Tok.getLiteralData()) {
+ OS.write(Tok.getLiteralData(), Tok.getLength());
} else if (Tok.getLength() < 256) {
const char *TokPtr = Buffer;
unsigned Len = PP.getSpelling(Tok, TokPtr);
More information about the cfe-commits
mailing list