From df2637d88aa14864cae48ae9f866dcba1900c332 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Tue, 20 Aug 2013 20:46:29 +0000 Subject: [PATCH] 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 --- contrib/llvm/tools/clang/lib/Sema/SemaExpr.cpp | 6 ++++-- 1 file 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 dd05b822364..a9179fd4889 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.