aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2008-05-27 15:24:04 +0000
committerEli Friedman <eli.friedman@gmail.com>2008-05-27 15:24:04 +0000
commit211f6adf1301a1461015fb6cb08a05f0a35b65f3 (patch)
tree03686ecabe41561e51092b1492d5118efa329fb2
parenta1d642db810e317da011569309ee0693d51b7dff (diff)
Assume statement expressions have side effects; this gets rid of a lot
of extra warnings in the Python source. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51594 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AST/Expr.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index e21686cf4e..d26ad1025d 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -319,14 +319,17 @@ bool Expr::hasLocalSideEffect() const {
// If the base pointer or element is to a volatile pointer/field, accessing
// if is a side effect.
return getType().isVolatileQualified();
-
+
case CallExprClass:
// TODO: check attributes for pure/const. "void foo() { strlen("bar"); }"
// should warn.
return true;
case ObjCMessageExprClass:
return true;
-
+ case StmtExprClass:
+ // TODO: check the inside of the statement expression
+ return true;
+
case CastExprClass:
// If this is a cast to void, check the operand. Otherwise, the result of
// the cast is unused.