Added more checking in "dead stores" for values that are initialized
but never used.
Fix a bug in LiveVariables where uses on the LHS of self-assign
operators (e.g +=, *=, etc) would not be properly recorded in the
liveness state of the variable.
llvm-svn: 41757
diff --git a/clang/Analysis/LiveVariables.cpp b/clang/Analysis/LiveVariables.cpp
index 6b25f9e..bf44374 100644
--- a/clang/Analysis/LiveVariables.cpp
+++ b/clang/Analysis/LiveVariables.cpp
@@ -252,7 +252,10 @@
// We only need to register kills once, so we check if this block
// has been previously processed.
if (!blockPreviouslyProcessed)
- V.AddKill(CurrentStmt,DR);
+ V.AddKill(CurrentStmt,DR);
+
+ if (B->getOpcode() != BinaryOperator::Assign)
+ Visit(LHS);
}
else
Visit(LHS);