svn commit: r254581 - head/contrib/llvm/tools/clang/lib/Sema

Dimitry Andric dim at FreeBSD.org
Tue Aug 20 20:46:29 UTC 2013


Author: dim
Date: Tue Aug 20 20:46:29 2013
New Revision: 254581
URL: http://svnweb.freebsd.org/changeset/base/254581

Log:
  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

Modified:
  head/contrib/llvm/tools/clang/lib/Sema/SemaExpr.cpp

Modified: head/contrib/llvm/tools/clang/lib/Sema/SemaExpr.cpp
==============================================================================
--- head/contrib/llvm/tools/clang/lib/Sema/SemaExpr.cpp	Tue Aug 20 20:40:20 2013	(r254580)
+++ head/contrib/llvm/tools/clang/lib/Sema/SemaExpr.cpp	Tue Aug 20 20:46:29 2013	(r254581)
@@ -8884,14 +8884,16 @@ EmitDiagnosticForLogicalAndInLogicalOr(S
 /// '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.


More information about the svn-src-head mailing list