[cfe-commits] r41756 - /cfe/trunk/Analysis/LiveVariables.cpp
Ted Kremenek
kremenek at apple.com
Thu Sep 6 16:25:11 PDT 2007
Author: kremenek
Date: Thu Sep 6 18:25:10 2007
New Revision: 41756
URL: http://llvm.org/viewvc/llvm-project?rev=41756&view=rev
Log:
Minor bug fixes to corner cases where LiveVariables would crash on some CFGs
that contained no declarations, or when a variable is declared but never used.
Modified:
cfe/trunk/Analysis/LiveVariables.cpp
Modified: cfe/trunk/Analysis/LiveVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/LiveVariables.cpp?rev=41756&r1=41755&r2=41756&view=diff
==============================================================================
--- cfe/trunk/Analysis/LiveVariables.cpp (original)
+++ cfe/trunk/Analysis/LiveVariables.cpp Thu Sep 6 18:25:10 2007
@@ -40,7 +40,9 @@
void VisitStmt(Stmt* S);
void VisitDeclRefExpr(DeclRefExpr* DR);
+ void VisitDeclStmt(DeclStmt* DS);
void Register(Decl* D);
+ void RegisterDeclChain(Decl* D);
void RegisterUsedDecls();
};
@@ -50,7 +52,15 @@
}
void RegisterDecls::VisitDeclRefExpr(DeclRefExpr* DR) {
- for (Decl* D = DR->getDecl() ; D != NULL ; D = D->getNextDeclarator())
+ RegisterDeclChain(DR->getDecl());
+}
+
+void RegisterDecls::VisitDeclStmt(DeclStmt* DS) {
+ RegisterDeclChain(DS->getDecl());
+}
+
+void RegisterDecls::RegisterDeclChain(Decl* D) {
+ for (; D != NULL ; D = D->getNextDeclarator())
Register(D);
}
@@ -363,7 +373,6 @@
void LiveVariables::runOnBlock(const CFGBlock* B, LiveVariablesAuditor* Auditor)
{
- assert (NumDecls && "You must use runOnCFG before using runOnBlock.");
LivenessTFuncs TF(*this,Auditor);
TF.ProcessBlock(B);
}
More information about the cfe-commits
mailing list