Convert analyses to new pass structure
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1603 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/IPA/CallGraph.cpp b/lib/Analysis/IPA/CallGraph.cpp
index e48cf7f..244c35e 100644
--- a/lib/Analysis/IPA/CallGraph.cpp
+++ b/lib/Analysis/IPA/CallGraph.cpp
@@ -19,6 +19,9 @@
#include "Support/STLExtras.h"
#include <algorithm>
+AnalysisID cfg::CallGraph::ID(AnalysisID::create<cfg::CallGraph>());
+//AnalysisID cfg::CallGraph::ID(AnalysisID::template AnalysisID<cfg::CallGraph>());
+
// getNodeFor - Return the node for the specified method or create one if it
// does not already exist.
//
@@ -53,7 +56,9 @@
}
}
-cfg::CallGraph::CallGraph(Module *TheModule) {
+bool cfg::CallGraph::run(Module *TheModule) {
+ destroy();
+
Mod = TheModule;
// Create the root node of the module...
@@ -61,13 +66,16 @@
// Add every method to the call graph...
for_each(Mod->begin(), Mod->end(), bind_obj(this,&CallGraph::addToCallGraph));
+
+ return false;
}
-cfg::CallGraph::~CallGraph() {
+void cfg::CallGraph::destroy() {
for (MethodMapTy::iterator I = MethodMap.begin(), E = MethodMap.end();
I != E; ++I) {
delete I->second;
}
+ MethodMap.clear();
}