diff options
author | David Blaikie <dblaikie@gmail.com> | 2013-03-18 23:22:28 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2013-03-18 23:22:28 +0000 |
commit | abc0bea57d4e659d5cde178a4bb426acc48f999e (patch) | |
tree | 8c8301a4b015fc9fd640b3688c30e1400600d69d /lib/Lex/PPExpressions.cpp | |
parent | e4d6112a4eaf341afacd95c9585efc28ec2eac5a (diff) |
PR15539: Record "evaluating if/elif condition" flag in the right place
The previous implementation missed the case where the elif condition was
evaluated from the context of an #ifdef that was false causing PR15539.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177345 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/PPExpressions.cpp')
-rw-r--r-- | lib/Lex/PPExpressions.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Lex/PPExpressions.cpp b/lib/Lex/PPExpressions.cpp index 49f4cbf71a..27ad7b4a1b 100644 --- a/lib/Lex/PPExpressions.cpp +++ b/lib/Lex/PPExpressions.cpp @@ -24,6 +24,7 @@ #include "clang/Lex/MacroInfo.h" #include "llvm/ADT/APSInt.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/SaveAndRestore.h" using namespace clang; namespace { @@ -730,6 +731,7 @@ static bool EvaluateDirectiveSubExpr(PPValue &LHS, unsigned MinPrec, /// to "!defined(X)" return X in IfNDefMacro. bool Preprocessor:: EvaluateDirectiveExpression(IdentifierInfo *&IfNDefMacro) { + SaveAndRestore<bool> PPDir(ParsingIfOrElifDirective, true); // Save the current state of 'DisableMacroExpansion' and reset it to false. If // 'DisableMacroExpansion' is true, then we must be in a macro argument list // in which case a directive is undefined behavior. We want macros to be able |