aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Analysis/PathSensitive/AnalysisManager.h
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2009-09-10 05:44:00 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2009-09-10 05:44:00 +0000
commitb317f8f5ca8737a5bbad97a3f7566a2dbd2ed61b (patch)
treedbab3bddeef187575b62017955dc3caccaf9c922 /include/clang/Analysis/PathSensitive/AnalysisManager.h
parentf84a4a469d8a45c76cb941595582a0fd3b9b15d3 (diff)
Make AnalysisManager stateless. Now other analyzer components only depends on
local node information. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81433 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Analysis/PathSensitive/AnalysisManager.h')
-rw-r--r--include/clang/Analysis/PathSensitive/AnalysisManager.h75
1 files changed, 20 insertions, 55 deletions
diff --git a/include/clang/Analysis/PathSensitive/AnalysisManager.h b/include/clang/Analysis/PathSensitive/AnalysisManager.h
index 948bb1fe8a..868e3c06e4 100644
--- a/include/clang/Analysis/PathSensitive/AnalysisManager.h
+++ b/include/clang/Analysis/PathSensitive/AnalysisManager.h
@@ -22,9 +22,7 @@
namespace clang {
class AnalysisManager : public BugReporterData {
- AnalysisContextManager ContextMgr;
- AnalysisContext *EntryContext;
-
+ AnalysisContextManager AnaCtxMgr;
LocationContextManager LocCtxMgr;
ASTContext &Ctx;
@@ -55,22 +53,7 @@ class AnalysisManager : public BugReporterData {
bool TrimGraph;
public:
- AnalysisManager(Decl *d, ASTContext &ctx, Diagnostic &diags,
- const LangOptions &lang, PathDiagnosticClient *pd,
- StoreManagerCreator storemgr,
- ConstraintManagerCreator constraintmgr,
- bool displayProgress, bool vizdot, bool vizubi,
- bool purge, bool eager, bool trim)
- : Ctx(ctx), Diags(diags), LangInfo(lang), PD(pd),
- CreateStoreMgr(storemgr), CreateConstraintMgr(constraintmgr),
- AScope(ScopeDecl), DisplayedFunction(!displayProgress),
- VisualizeEGDot(vizdot), VisualizeEGUbi(vizubi), PurgeDead(purge),
- EagerlyAssume(eager), TrimGraph(trim) {
-
- EntryContext = ContextMgr.getContext(d);
- }
-
- AnalysisManager(ASTContext &ctx, Diagnostic &diags,
+ AnalysisManager(ASTContext &ctx, Diagnostic &diags,
const LangOptions &lang, PathDiagnosticClient *pd,
StoreManagerCreator storemgr,
ConstraintManagerCreator constraintmgr,
@@ -81,25 +64,7 @@ public:
CreateStoreMgr(storemgr), CreateConstraintMgr(constraintmgr),
AScope(ScopeDecl), DisplayedFunction(!displayProgress),
VisualizeEGDot(vizdot), VisualizeEGUbi(vizubi), PurgeDead(purge),
- EagerlyAssume(eager), TrimGraph(trim) {
-
- EntryContext = 0;
- }
-
- void setEntryContext(Decl *D) {
- EntryContext = ContextMgr.getContext(D);
- DisplayedFunction = false;
- }
-
- const Decl *getCodeDecl() const {
- assert (AScope == ScopeDecl);
- return EntryContext->getDecl();
- }
-
- Stmt *getBody() const {
- assert (AScope == ScopeDecl);
- return EntryContext->getBody();
- }
+ EagerlyAssume(eager), TrimGraph(trim) {}
StoreManagerCreator getStoreManagerCreator() {
return CreateStoreMgr;
@@ -109,18 +74,6 @@ public:
return CreateConstraintMgr;
}
- virtual CFG *getCFG() {
- return EntryContext->getCFG();
- }
-
- virtual ParentMap &getParentMap() {
- return EntryContext->getParentMap();
- }
-
- virtual LiveVariables *getLiveVariables() {
- return EntryContext->getLiveVariables();
- }
-
virtual ASTContext &getASTContext() {
return Ctx;
}
@@ -141,10 +94,6 @@ public:
return PD.get();
}
- StackFrameContext *getEntryStackFrame() {
- return LocCtxMgr.getStackFrame(EntryContext, 0, 0);
- }
-
bool shouldVisualizeGraphviz() const { return VisualizeEGDot; }
bool shouldVisualizeUbigraph() const { return VisualizeEGUbi; }
@@ -159,7 +108,23 @@ public:
bool shouldEagerlyAssume() const { return EagerlyAssume; }
- void DisplayFunction();
+ void DisplayFunction(Decl *D);
+
+ CFG *getCFG(Decl const *D) {
+ return AnaCtxMgr.getContext(D)->getCFG();
+ }
+
+ LiveVariables *getLiveVariables(Decl const *D) {
+ return AnaCtxMgr.getContext(D)->getLiveVariables();
+ }
+
+ ParentMap &getParentMap(Decl const *D) {
+ return AnaCtxMgr.getContext(D)->getParentMap();
+ }
+
+ StackFrameContext *getStackFrame(Decl const *D) {
+ return LocCtxMgr.getStackFrame(AnaCtxMgr.getContext(D), 0, 0);
+ }
};
}