diff options
| author | Chris Lattner <sabre@nondot.org> | 2008-01-07 19:50:27 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2008-01-07 19:50:27 +0000 |
| commit | a30be59fa24156dd7edde042276de746c89a228f (patch) | |
| tree | 9dfb02c531a66db72740499501f82a9ffe7c3c1f /clang/Lex/Preprocessor.cpp | |
| parent | 1b0ea824591f2a6e341890c8a9a10f1c964bc54f (diff) | |
| download | bcm5719-llvm-a30be59fa24156dd7edde042276de746c89a228f.tar.gz bcm5719-llvm-a30be59fa24156dd7edde042276de746c89a228f.zip | |
Fix a nasty corner case that Neil noticed in PR1900, where we would
incorrectly apply the multiple include optimization to files with
guards like:
#if !defined(x) MACRO
where MACRO could expand to different things in different contexts.
Thanks Neil!
llvm-svn: 45716
Diffstat (limited to 'clang/Lex/Preprocessor.cpp')
| -rw-r--r-- | clang/Lex/Preprocessor.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/Lex/Preprocessor.cpp b/clang/Lex/Preprocessor.cpp index baabd8ee00b..accccc4fbcd 100644 --- a/clang/Lex/Preprocessor.cpp +++ b/clang/Lex/Preprocessor.cpp @@ -784,6 +784,10 @@ bool Preprocessor::isNextPPTokenLParen() { /// expanded as a macro, handle it and return the next token as 'Identifier'. bool Preprocessor::HandleMacroExpandedIdentifier(Token &Identifier, MacroInfo *MI) { + // If this is a macro exapnsion in the "#if !defined(x)" line for the file, + // then the macro could expand to different things in other contexts, we need + // to disable the optimization in this case. + if (CurLexer) CurLexer->MIOpt.ExpandedMacro(); // If this is a builtin macro, like __LINE__ or _Pragma, handle it specially. if (MI->isBuiltinMacro()) { |

