[cfe-commits] r51276 - in /cfe/trunk: lib/AST/Expr.cpp test/Sema/unused-expr.c
Eli Friedman
eli.friedman at gmail.com
Mon May 19 14:24:43 PDT 2008
Author: efriedma
Date: Mon May 19 16:24:43 2008
New Revision: 51276
URL: http://llvm.org/viewvc/llvm-project?rev=51276&view=rev
Log:
Make the unused expression warning a bit less aggressive (found in PHP
code).
Modified:
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/test/Sema/unused-expr.c
Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=51276&r1=51275&r2=51276&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Mon May 19 16:24:43 2008
@@ -336,6 +336,10 @@
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();
}
Modified: cfe/trunk/test/Sema/unused-expr.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/unused-expr.c?rev=51276&r1=51275&r2=51276&view=diff
==============================================================================
--- cfe/trunk/test/Sema/unused-expr.c (original)
+++ cfe/trunk/test/Sema/unused-expr.c Mon May 19 16:24:43 2008
@@ -35,3 +35,8 @@
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;
+}
More information about the cfe-commits
mailing list