summaryrefslogtreecommitdiffstats
path: root/clang/Lex/Lexer.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-06-18 16:41:01 +0000
committerChris Lattner <sabre@nondot.org>2006-06-18 16:41:01 +0000
commitc5a00067acb205f537ce43c60c4ff3707a29512b (patch)
tree2f11ebf4e4b7d48613e4f4a5e018b4184e821fe3 /clang/Lex/Lexer.cpp
parent8bb4edb23623f09de8e4d43c0b91d6f22e4fe6ed (diff)
downloadbcm5719-llvm-c5a00067acb205f537ce43c60c4ff3707a29512b.tar.gz
bcm5719-llvm-c5a00067acb205f537ce43c60c4ff3707a29512b.zip
Simplify some code
llvm-svn: 38555
Diffstat (limited to 'clang/Lex/Lexer.cpp')
-rw-r--r--clang/Lex/Lexer.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/clang/Lex/Lexer.cpp b/clang/Lex/Lexer.cpp
index e8572ac1653..3c4bb535948 100644
--- a/clang/Lex/Lexer.cpp
+++ b/clang/Lex/Lexer.cpp
@@ -341,21 +341,20 @@ FinishIdentifier:
Result.SetKind(tok::identifier);
// Look up this token, see if it is a macro, or if it is a language keyword.
- const char *SpelledTokStart, *SpelledTokEnd;
+ IdentifierTokenInfo *II;
if (!Result.needsCleaning()) {
// No cleaning needed, just use the characters from the lexed buffer.
- SpelledTokStart = IdStart;
- SpelledTokEnd = IdEnd;
+ II = PP.getIdentifierInfo(IdStart, IdEnd);
} else {
// Cleaning needed, alloca a buffer, clean into it, then use the buffer.
char *TmpBuf = (char*)alloca(Result.getLength());
unsigned Size = PP.getSpelling(Result, TmpBuf);
- SpelledTokStart = TmpBuf;
- SpelledTokEnd = TmpBuf+Size;
+ II = PP.getIdentifierInfo(TmpBuf, TmpBuf+Size);
}
+ Result.SetIdentifierInfo(II);
- Result.SetIdentifierInfo(PP.getIdentifierInfo(SpelledTokStart,
- SpelledTokEnd));
+ // Finally, now that we know we have an identifier, pass this off to the
+ // preprocessor, which may macro expand it or something.
return PP.HandleIdentifier(Result);
}
OpenPOWER on IntegriCloud