From 824f8c12fdfd3bb729743e12a2c0fe4cce143057 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 27 May 2008 15:24:04 +0000 Subject: [PATCH] Assume statement expressions have side effects; this gets rid of a lot of extra warnings in the Python source. llvm-svn: 51594 --- clang/lib/AST/Expr.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index e21686cf4ef1..d26ad1025d88 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/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.