summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2013-08-20 20:46:29 +0000
committerdim <dim@FreeBSD.org>2013-08-20 20:46:29 +0000
commitbe9185df2cce48a086d57c7f8bc6bad5030db6a4 (patch)
tree921ff5b0d4cb9a25b4a71caebc742e0a11c22411 /contrib/llvm/tools
parent636d64b28dc55ebc08b5789074cd69ea8eb90a08 (diff)
downloadFreeBSD-src-be9185df2cce48a086d57c7f8bc6bad5030db6a4.zip
FreeBSD-src-be9185df2cce48a086d57c7f8bc6bad5030db6a4.tar.gz
Pull in r188716 from upstream clang trunk:
PR16727: don't try to evaluate a potentially value-dependent expression when checking for missing parens in &&/|| expressions. This fixes an assertion encountered when building the lang/sdcc port. Reported by: kwm
Diffstat (limited to 'contrib/llvm/tools')
-rw-r--r--contrib/llvm/tools/clang/lib/Sema/SemaExpr.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/contrib/llvm/tools/clang/lib/Sema/SemaExpr.cpp b/contrib/llvm/tools/clang/lib/Sema/SemaExpr.cpp
index dd05b82..a9179fd 100644
--- a/contrib/llvm/tools/clang/lib/Sema/SemaExpr.cpp
+++ b/contrib/llvm/tools/clang/lib/Sema/SemaExpr.cpp
@@ -8884,14 +8884,16 @@ EmitDiagnosticForLogicalAndInLogicalOr(Sema &Self, SourceLocation OpLoc,
/// 'true'.
static bool EvaluatesAsTrue(Sema &S, Expr *E) {
bool Res;
- return E->EvaluateAsBooleanCondition(Res, S.getASTContext()) && Res;
+ return !E->isValueDependent() &&
+ E->EvaluateAsBooleanCondition(Res, S.getASTContext()) && Res;
}
/// \brief Returns true if the given expression can be evaluated as a constant
/// 'false'.
static bool EvaluatesAsFalse(Sema &S, Expr *E) {
bool Res;
- return E->EvaluateAsBooleanCondition(Res, S.getASTContext()) && !Res;
+ return !E->isValueDependent() &&
+ E->EvaluateAsBooleanCondition(Res, S.getASTContext()) && !Res;
}
/// \brief Look for '&&' in the left hand of a '||' expr.
OpenPOWER on IntegriCloud