diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-10-07 22:21:02 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-10-07 22:21:02 +0000 |
commit | a5937bbfd19e61d651a58b0f0ffeef68457902a5 (patch) | |
tree | 89900f2c77818128c031816dfe2a5154ee1ef592 /lib/StaticAnalyzer | |
parent | ec2ec1f20322076717c3865b196f7a1c95d883a4 (diff) |
Remove AnalysisContext::getLiveVariables(), and introduce a templatized mechanism to lazily create analyses that are attached to AnalysisContext objects.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141425 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer')
-rw-r--r-- | lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp | 2 | ||||
-rw-r--r-- | lib/StaticAnalyzer/Checkers/DebugCheckers.cpp | 2 | ||||
-rw-r--r-- | lib/StaticAnalyzer/Core/SymbolManager.cpp | 6 | ||||
-rw-r--r-- | lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp | 5 |
4 files changed, 6 insertions, 9 deletions
diff --git a/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp b/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp index 5d272ea382..df66aaf19a 100644 --- a/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp @@ -348,7 +348,7 @@ class DeadStoresChecker : public Checker<check::ASTCodeBody> { public: void checkASTCodeBody(const Decl *D, AnalysisManager& mgr, BugReporter &BR) const { - if (LiveVariables *L = mgr.getLiveVariables(D)) { + if (LiveVariables *L = mgr.getAnalysis<LiveVariables>(D)) { CFG &cfg = *mgr.getCFG(D); AnalysisContext *AC = mgr.getAnalysisContext(D); ParentMap &pmap = mgr.getParentMap(D); diff --git a/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp b/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp index 486b7f7feb..d9d569423d 100644 --- a/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp +++ b/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp @@ -28,7 +28,7 @@ class LiveVariablesDumper : public Checker<check::ASTCodeBody> { public: void checkASTCodeBody(const Decl *D, AnalysisManager& mgr, BugReporter &BR) const { - if (LiveVariables* L = mgr.getLiveVariables(D)) { + if (LiveVariables* L = mgr.getAnalysis<LiveVariables>(D)) { L->dumpBlockLiveness(mgr.getSourceManager()); } } diff --git a/lib/StaticAnalyzer/Core/SymbolManager.cpp b/lib/StaticAnalyzer/Core/SymbolManager.cpp index dc3a2fe660..b843ab1a90 100644 --- a/lib/StaticAnalyzer/Core/SymbolManager.cpp +++ b/lib/StaticAnalyzer/Core/SymbolManager.cpp @@ -382,8 +382,7 @@ bool SymbolReaper::isLive(SymbolRef sym) { } bool SymbolReaper::isLive(const Stmt *ExprVal) const { - return LCtx->getAnalysisContext()->getRelaxedLiveVariables()-> - isLive(Loc, ExprVal); + return LCtx->getAnalysis<RelaxedLiveVariables>()->isLive(Loc, ExprVal); } bool SymbolReaper::isLive(const VarRegion *VR, bool includeStoreBindings) const{ @@ -391,8 +390,7 @@ bool SymbolReaper::isLive(const VarRegion *VR, bool includeStoreBindings) const{ const StackFrameContext *CurrentContext = LCtx->getCurrentStackFrame(); if (VarContext == CurrentContext) { - if (LCtx->getAnalysisContext()->getRelaxedLiveVariables()-> - isLive(Loc, VR->getDecl())) + if (LCtx->getAnalysis<RelaxedLiveVariables>()->isLive(Loc, VR->getDecl())) return true; if (!includeStoreBindings) diff --git a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp index 876136ba68..50cbefd142 100644 --- a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp @@ -304,10 +304,9 @@ void AnalysisConsumer::HandleCode(Decl *D) { static void ActionExprEngine(AnalysisConsumer &C, AnalysisManager &mgr, Decl *D, bool ObjCGCEnabled) { - // Construct the analysis engine. We first query for the LiveVariables - // information to see if the CFG is valid. + // Construct the analysis engine. First check if the CFG is valid. // FIXME: Inter-procedural analysis will need to handle invalid CFGs. - if (!mgr.getLiveVariables(D)) + if (!mgr.getCFG(D)) return; ExprEngine Eng(mgr, ObjCGCEnabled); |