Added "Dead Stores", a flow-sensitive checker that checks for stores
to variables that are no longer live. This analysis is built on top
of CFGs and the LiveVariables analysis.
changes to driver:
added driver option "-check-dead-stores" to run the analysis
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41754 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Analysis/LiveVariables.cpp b/Analysis/LiveVariables.cpp
index 6290651..b5248fe 100644
--- a/Analysis/LiveVariables.cpp
+++ b/Analysis/LiveVariables.cpp
@@ -372,7 +372,7 @@
// liveness queries
//
-bool LiveVariables::IsLive(const CFGBlock* B, const Decl* D) const {
+bool LiveVariables::isLive(const CFGBlock* B, const Decl* D) const {
BlockLivenessMap::const_iterator I = LiveAtBlockEntryMap.find(B);
assert (I != LiveAtBlockEntryMap.end());
@@ -382,6 +382,12 @@
return I->second[VI->second.Idx];
}
+bool LiveVariables::isLive(llvm::BitVector& Live, const Decl* D) const {
+ VarInfoMap::const_iterator VI = VarInfos.find(D);
+ assert (VI != VarInfos.end());
+ return Live[VI->second.Idx];
+}
+
bool LiveVariables::KillsVar(const Stmt* S, const Decl* D) const {
VarInfoMap::const_iterator VI = VarInfos.find(D);
assert (VI != VarInfos.end());
@@ -405,6 +411,15 @@
}
//===----------------------------------------------------------------------===//
+// Defaults for LiveVariablesAuditor
+
+void LiveVariablesAuditor::AuditStmt(Stmt* S, LiveVariables& L,
+ llvm::BitVector& V) {}
+
+void LiveVariablesAuditor::AuditBlockExit(const CFGBlock* B, LiveVariables& L,
+ llvm::BitVector& V) {}
+
+//===----------------------------------------------------------------------===//
// printing liveness state for debugging
//