aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-07-23 06:14:36 +0000
committerChris Lattner <sabre@nondot.org>2007-07-23 06:14:36 +0000
commit2933f41ed59a8bf1866292cb82e16c8b10dc6651 (patch)
treec824a18d9710a45c575c0bdd3e1077290322c71a
parentf0f2b295437efecc0b52220b3f4a469fbb9aeac8 (diff)
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% git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40422 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--Driver/PrintPreprocessedOutput.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/Driver/PrintPreprocessedOutput.cpp b/Driver/PrintPreprocessedOutput.cpp
index a7d55df34b..d1f1cef985 100644
--- a/Driver/PrintPreprocessedOutput.cpp
+++ b/Driver/PrintPreprocessedOutput.cpp
@@ -517,7 +517,11 @@ void clang::DoPrintPreprocessedInput(unsigned MainFileID, Preprocessor &PP,
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);