diff options
author | dim <dim@FreeBSD.org> | 2013-08-20 20:46:29 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-08-20 20:46:29 +0000 |
commit | be9185df2cce48a086d57c7f8bc6bad5030db6a4 (patch) | |
tree | 921ff5b0d4cb9a25b4a71caebc742e0a11c22411 | |
parent | 636d64b28dc55ebc08b5789074cd69ea8eb90a08 (diff) | |
download | FreeBSD-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
-rw-r--r-- | contrib/llvm/tools/clang/lib/Sema/SemaExpr.cpp | 6 |
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. |