diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-26 19:29:26 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-26 19:29:26 +0000 |
commit | 5a7971e0c31a10959d555b3c321baece799afb73 (patch) | |
tree | cb7e2df548c6736937c020807fbea9144b55d04a /clang/Driver/PrintPreprocessedOutput.cpp | |
parent | 4b4622454c2836ed27bf2fcb5ad30256fe14802e (diff) | |
download | bcm5719-llvm-5a7971e0c31a10959d555b3c321baece799afb73.tar.gz bcm5719-llvm-5a7971e0c31a10959d555b3c321baece799afb73.zip |
This change refactors some of the low-level lexer interfaces a bit.
Token now has a class of kinds for "literals", which include
numeric constants, strings, etc. These tokens can optionally have
a pointer to the start of the token in the lexer buffer. This
makes it faster to get spelling and do other gymnastics, because we
don't have to go through source locations.
This change is performance neutral, but will make other changes
more feasible down the road.
llvm-svn: 63028
Diffstat (limited to 'clang/Driver/PrintPreprocessedOutput.cpp')
-rw-r--r-- | clang/Driver/PrintPreprocessedOutput.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/Driver/PrintPreprocessedOutput.cpp b/clang/Driver/PrintPreprocessedOutput.cpp index 64cc4c8be65..deecacb1f4c 100644 --- a/clang/Driver/PrintPreprocessedOutput.cpp +++ b/clang/Driver/PrintPreprocessedOutput.cpp @@ -430,6 +430,7 @@ bool PrintPPOutputPPCallbacks::AvoidConcat(const Token &PrevTok, // 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())); @@ -556,6 +557,7 @@ void clang::DoPrintPreprocessedInput(Preprocessor &PP, const char *Str = II->getName(); unsigned Len = Tok.needsCleaning() ? strlen(Str) : Tok.getLength(); OS.write(Str, Len); + // FIXME: ACCELERATE LITERALS } else if (Tok.getLength() < 256) { const char *TokPtr = Buffer; unsigned Len = PP.getSpelling(Tok, TokPtr); |