summaryrefslogtreecommitdiffstats
path: root/clang/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
commite236a482103425102319ac17f2980164e6241a97 (patch)
tree3e54f96690961f04ed5283b0f9364f4e1f06f340 /clang/lib/AST/ExprConstant.cpp
parent420426100cbdb2d8d18cbca2914625cdebc5bef8 (diff)
downloadbcm5719-llvm-e236a482103425102319ac17f2980164e6241a97.tar.gz
bcm5719-llvm-e236a482103425102319ac17f2980164e6241a97.zip
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 llvm-svn: 59422
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r--clang/lib/AST/ExprConstant.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index bedc78c0c05..0ffbf581a2c 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/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()) {
OpenPOWER on IntegriCloud