diff options
| -rw-r--r-- | clang/lib/Analysis/CheckDeadStores.cpp | 7 | ||||
| -rw-r--r-- | clang/test/Analysis/dead-stores.c | 2 |
2 files changed, 2 insertions, 7 deletions
diff --git a/clang/lib/Analysis/CheckDeadStores.cpp b/clang/lib/Analysis/CheckDeadStores.cpp index 433e61154f9..4ab6680a78d 100644 --- a/clang/lib/Analysis/CheckDeadStores.cpp +++ b/clang/lib/Analysis/CheckDeadStores.cpp @@ -152,12 +152,7 @@ public: 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)) diff --git a/clang/test/Analysis/dead-stores.c b/clang/test/Analysis/dead-stores.c index 381bfcb2cf2..dce058c02e4 100644 --- a/clang/test/Analysis/dead-stores.c +++ b/clang/test/Analysis/dead-stores.c @@ -74,7 +74,7 @@ int f10() { int f11() { int x = 4; - return ++x; // no-warning + return ++x; // expected-warning{{never read}} } |

