diff options
author | Chris Lattner <sabre@nondot.org> | 2010-03-26 17:49:16 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-03-26 17:49:16 +0000 |
commit | 8c5d05a299486739e43ef787d153b2cec1552029 (patch) | |
tree | a256a1e76dee1f84f93e17888913cf58231abb7f /clang/lib/Lex | |
parent | cebeab9f8c7bcc1b5baabee45ab6a4db17a9648b (diff) | |
download | bcm5719-llvm-8c5d05a299486739e43ef787d153b2cec1552029.tar.gz bcm5719-llvm-8c5d05a299486739e43ef787d153b2cec1552029.zip |
fix a case where macro expansion should be disabled, patch by
Abramo Bagnara!
llvm-svn: 99626
Diffstat (limited to 'clang/lib/Lex')
-rw-r--r-- | clang/lib/Lex/PPMacroExpansion.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp index ffae8ab6afb..1c6a5ad0ebc 100644 --- a/clang/lib/Lex/PPMacroExpansion.cpp +++ b/clang/lib/Lex/PPMacroExpansion.cpp @@ -258,10 +258,13 @@ bool Preprocessor::HandleMacroExpandedIdentifier(Token &Identifier, InstantiationEnd,Identifier.getLength()); Identifier.setLocation(Loc); - // If this is #define X X, we must mark the result as unexpandible. - if (IdentifierInfo *NewII = Identifier.getIdentifierInfo()) - if (getMacroInfo(NewII) == MI) - Identifier.setFlag(Token::DisableExpand); + // If this is a disabled macro or #define X X, we must mark the result as + // unexpandable. + if (IdentifierInfo *NewII = Identifier.getIdentifierInfo()) { + if (MacroInfo *NewMI = getMacroInfo(NewII)) + if (!NewMI->isEnabled() || NewMI == MI) + Identifier.setFlag(Token::DisableExpand); + } // Since this is not an identifier token, it can't be macro expanded, so // we're done. |