summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-02-19 22:34:59 +0000
committerDouglas Gregor <dgregor@apple.com>2011-02-19 22:34:59 +0000
commit5b05454f248760f64b79109686c87f1c43f0d731 (patch)
treec4a59955166e6b3f0d62a0799c9346f838d5978a /clang/lib
parentb0ed51da1021414c5445b07955579dab625f454e (diff)
downloadbcm5719-llvm-5b05454f248760f64b79109686c87f1c43f0d731.tar.gz
bcm5719-llvm-5b05454f248760f64b79109686c87f1c43f0d731.zip
Don't produce "comparison is always (true|false)" warnings when the
comparison itself is a constant expression. Fixes PR7536. llvm-svn: 126057
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 2cddac5f667..556665483e6 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -2581,7 +2581,11 @@ void AnalyzeComparison(Sema &S, BinaryOperator *E) {
// We don't do anything special if this isn't an unsigned integral
// comparison: we're only interested in integral comparisons, and
// signed comparisons only happen in cases we don't care to warn about.
- if (!T->hasUnsignedIntegerRepresentation())
+ //
+ // We also don't care about value-dependent expressions or expressions
+ // whose result is a constant.
+ if (!T->hasUnsignedIntegerRepresentation()
+ || E->isValueDependent() || E->isIntegerConstantExpr(S.Context))
return AnalyzeImpConvsInComparison(S, E);
Expr *lex = E->getLHS()->IgnoreParenImpCasts();
OpenPOWER on IntegriCloud