summaryrefslogtreecommitdiffstats
path: root/clang/Lex/MacroExpander.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-07-20 04:16:23 +0000
committerChris Lattner <sabre@nondot.org>2006-07-20 04:16:23 +0000
commit0f1f50517b8a921c75e398b055726568e6d40d19 (patch)
treed0756ac89f342f3be4bdd83598a4d24422df766f /clang/Lex/MacroExpander.cpp
parent9100cff7014d619fd5d3e9ef40018ee80f2a27a8 (diff)
downloadbcm5719-llvm-0f1f50517b8a921c75e398b055726568e6d40d19.tar.gz
bcm5719-llvm-0f1f50517b8a921c75e398b055726568e6d40d19.zip
Simplify identifier lookup in raw mode, implementing Preprocessor/macro_fn_lparen_scan2.c.
llvm-svn: 38744
Diffstat (limited to 'clang/Lex/MacroExpander.cpp')
-rw-r--r--clang/Lex/MacroExpander.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/Lex/MacroExpander.cpp b/clang/Lex/MacroExpander.cpp
index d68e36f45e1..d65448759b6 100644
--- a/clang/Lex/MacroExpander.cpp
+++ b/clang/Lex/MacroExpander.cpp
@@ -508,6 +508,15 @@ void MacroExpander::PasteTokens(LexerToken &Tok) {
++CurToken;
Tok = Result;
} while (!isAtEnd() && (*MacroTokens)[CurToken].getKind() == tok::hashhash);
+
+ // Now that we got the result token, it will be subject to expansion. Since
+ // token pasting re-lexes the result token in raw mode, identifier information
+ // isn't looked up. As such, if the result is an identifier, look up id info.
+ if (Tok.getKind() == tok::identifier) {
+ // Look up the identifier info for the token. We disabled identifier lookup
+ // by saying we're skipping contents, so we need to do this manually.
+ Tok.SetIdentifierInfo(PP.LookUpIdentifierInfo(Tok));
+ }
}
/// isNextTokenLParen - If the next token lexed will pop this macro off the
OpenPOWER on IntegriCloud