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 | 8ff66de0d036842450eb979882f826d5252100f4 (patch) | |
tree | 8ed2736b5f876669c14b9c85c02a106b25233252 /lib/Lex/PPMacroExpansion.cpp | |
parent | c7cf27f3cb7839d2bf65cf580db7b7d034196043 (diff) |
fix a case where macro expansion should be disabled, patch by
Abramo Bagnara!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99626 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/PPMacroExpansion.cpp')
-rw-r--r-- | lib/Lex/PPMacroExpansion.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp index ffae8ab6af..1c6a5ad0eb 100644 --- a/lib/Lex/PPMacroExpansion.cpp +++ b/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. |