aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2008-11-16 20:09:07 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2008-11-16 20:09:07 +0000
commitf9ef0c675b12ab53fdd6c4e3e7226d066d293e99 (patch)
treef9cc2f8c04ae7278a53d77d737f183f0895fc7f1 /lib/AST/ExprConstant.cpp
parentca7c2eaca35edac066ab7cec15f7ecebbb3731d8 (diff)
fix folding of comma if given a non-constant operand.
Eli please take a look, as I'm not sure if this gets the extension warning in the right place git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59422 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r--lib/AST/ExprConstant.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp
index bedc78c0c0..0ffbf581a2 100644
--- a/lib/AST/ExprConstant.cpp
+++ b/lib/AST/ExprConstant.cpp
@@ -517,16 +517,17 @@ bool IntExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
// Evaluate the side that actually matters; this needs to be
// handled specially because calling Visit() on the LHS can
// have strange results when it doesn't have an integral type.
- Visit(E->getRHS());
+ if (Visit(E->getRHS()))
+ return true;
// Check for isEvaluated; the idea is that this might eventually
// be useful for isICE and other similar uses that care about
// whether a comma is evaluated. This isn't really used yet, though,
// and I'm not sure it really works as intended.
if (!Info.isEvaluated)
- return true;
+ return Extension(E->getOperatorLoc(), diag::ext_comma_in_constant_expr);
- return Extension(E->getOperatorLoc(), diag::ext_comma_in_constant_expr);
+ return false;
}
if (E->isLogicalOp()) {