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
This commit is contained in:
parent
9de51f489e
commit
df2637d88a
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user