diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2008-05-19 21:24:43 +0000 |
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2008-05-19 21:24:43 +0000 |
| commit | 4be1f47de20525ad90f02ba8682a7e2cbd3205d1 (patch) | |
| tree | 0a6b289ef1cb31d7f03584a473cf747addc54c05 | |
| parent | c56c977f44d0bd8422a6f0fe87f361cbb728c06b (diff) | |
Make the unused expression warning a bit less aggressive (found in PHP
code).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51276 91177308-0d34-0410-b5e6-96231b3b80d8
| -rw-r--r-- | lib/AST/Expr.cpp | 4 | ||||
| -rw-r--r-- | test/Sema/unused-expr.c | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index cd495bc63e..e327ffb911 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -336,6 +336,10 @@ bool Expr::hasLocalSideEffect() const { return cast<CastExpr>(this)->getSubExpr()->hasLocalSideEffect(); return false; + case ImplicitCastExprClass: + // Check the operand, since implicit casts are inserted by Sema + return cast<ImplicitCastExpr>(this)->getSubExpr()->hasLocalSideEffect(); + case CXXDefaultArgExprClass: return cast<CXXDefaultArgExpr>(this)->getExpr()->hasLocalSideEffect(); } diff --git a/test/Sema/unused-expr.c b/test/Sema/unused-expr.c index 305c2be06b..b14daa702d 100644 --- a/test/Sema/unused-expr.c +++ b/test/Sema/unused-expr.c @@ -35,3 +35,8 @@ int stmt_expr(int x, int y) { return ({int _a = x, _b = y; _a > _b ? _a : _b; }); } +void nowarn(unsigned char* a, unsigned char* b) +{ + unsigned char c = 1; + *a |= c, *b += c; +} |
