Author: kremenek
Date: Thu Jul 24 12:01:17 2008
New Revision: 53983

URL: http://llvm.org/viewvc/llvm-project?rev=53983&view=rev
Log:
Issue dead store warnings for preincrements involved in a subexpression.

Modified:
    cfe/trunk/lib/Analysis/CheckDeadStores.cpp
    cfe/trunk/test/Analysis/dead-stores.c

Modified: cfe/trunk/lib/Analysis/CheckDeadStores.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CheckDeadStores.cpp?rev=53983&r1=53982&r2=53983&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/CheckDeadStores.cpp (original)
+++ cfe/trunk/lib/Analysis/CheckDeadStores.cpp Thu Jul 24 12:01:17 2008
@@ -152,12 +152,7 @@
     else if (UnaryOperator* U = dyn_cast<UnaryOperator>(S)) {
       if (!U->isIncrementOp())
         return;
-      
-      // Don't flag dead stores when the result of a preincrement/predecrement
-      // is used in an enclosing expression.
-      if (U->isPrefix() && Parents.isSubExpr(U))
-        return;
-      
+
       Expr *Ex = U->getSubExpr()->IgnoreParenCasts();
       
       if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(Ex))

Modified: cfe/trunk/test/Analysis/dead-stores.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/dead-stores.c?rev=53983&r1=53982&r2=53983&view=diff

==============================================================================
--- cfe/trunk/test/Analysis/dead-stores.c (original)
+++ cfe/trunk/test/Analysis/dead-stores.c Thu Jul 24 12:01:17 2008
@@ -74,7 +74,7 @@
 
 int f11() {
   int x = 4;
-  return ++x; // no-warning
+  return ++x; // expected-warning{{never read}}
 }
 
 


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to