summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2014-04-28 00:20:16 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2014-04-28 00:20:16 +0000
commitd6eb2b9f4d4fc236376e3a5a7b8faa31e8dd427d (patch)
treeacfd3fea20ef0eea4652c569d2f36ad595f10aa4 /clang/lib/Sema/SemaExpr.cpp
parent20c5693e9e9d0cc801bc2411870b1a9d6362f425 (diff)
downloadbcm5719-llvm-d6eb2b9f4d4fc236376e3a5a7b8faa31e8dd427d.tar.gz
bcm5719-llvm-d6eb2b9f4d4fc236376e3a5a7b8faa31e8dd427d.zip
[SemaCXX] Silence -Wconstant-logical-operand if the operand is a 0/1 from a macro.
Libraries specify enabled/disabled features using macro defs of 0/1, in such cases the -Wconstant-logical-operand is noise. rdar://15410291 llvm-svn: 207386
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 6d624adc4eb..595770dc36b 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -8268,7 +8268,8 @@ inline QualType Sema::CheckLogicalOperands( // C99 6.5.[13,14]
// Parens on the RHS are ignored.
llvm::APSInt Result;
if (RHS.get()->EvaluateAsInt(Result, Context))
- if ((getLangOpts().Bool && !RHS.get()->getType()->isBooleanType()) ||
+ if ((getLangOpts().Bool && !RHS.get()->getType()->isBooleanType() &&
+ !RHS.get()->getExprLoc().isMacroID()) ||
(Result != 0 && Result != 1)) {
Diag(Loc, diag::warn_logical_instead_of_bitwise)
<< RHS.get()->getSourceRange()
OpenPOWER on IntegriCloud