diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-08-30 13:38:46 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-08-30 13:38:46 +0000 |
commit | c30981a563a8947cb26b1e308d122fa2ef90fceb (patch) | |
tree | be7c0367d7be45d668115cc556982c847b875867 /lib/Lex/PPLexerChange.cpp | |
parent | 3bc22262af7b09a459b400976cfce3d9318b8ea9 (diff) |
Make preprocessor act in a GCC-compatible fashion when a macro is redefined
within its own argument list. The original definition is used for the immediate
expansion, but the new definition is used for any subsequent occurences within
the argument list or after the expansion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162906 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/PPLexerChange.cpp')
-rw-r--r-- | lib/Lex/PPLexerChange.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Lex/PPLexerChange.cpp b/lib/Lex/PPLexerChange.cpp index e824320cf7..d827f58a48 100644 --- a/lib/Lex/PPLexerChange.cpp +++ b/lib/Lex/PPLexerChange.cpp @@ -157,15 +157,15 @@ void Preprocessor::EnterSourceFileWithPTH(PTHLexer *PL, /// EnterMacro - Add a Macro to the top of the include stack and start lexing /// tokens from it instead of the current buffer. void Preprocessor::EnterMacro(Token &Tok, SourceLocation ILEnd, - MacroArgs *Args) { + MacroInfo *Macro, MacroArgs *Args) { PushIncludeMacroStack(); CurDirLookup = 0; if (NumCachedTokenLexers == 0) { - CurTokenLexer.reset(new TokenLexer(Tok, ILEnd, Args, *this)); + CurTokenLexer.reset(new TokenLexer(Tok, ILEnd, Macro, Args, *this)); } else { CurTokenLexer.reset(TokenLexerCache[--NumCachedTokenLexers]); - CurTokenLexer->Init(Tok, ILEnd, Args); + CurTokenLexer->Init(Tok, ILEnd, Macro, Args); } if (CurLexerKind != CLK_LexAfterModuleImport) CurLexerKind = CLK_TokenLexer; |