destroy();
}
+ /// Print the types found in the module. If the optional Module parameter is
+ /// passed in, then the types are printed symbolically if possible, using the
+ /// symbol table from the module.
+ ///
+ void print(std::ostream &o, const Module *M) const;
+
private:
//===---------------------------------------------------------------------
// Implementation of CallGraph construction
}
};
-
-//===----------------------------------------------------------------------===//
-// Printing support for Call Graphs
-//
-
-// Stuff for printing out a callgraph...
-
-void WriteToOutput(const CallGraph &, std::ostream &o);
-inline std::ostream &operator <<(std::ostream &o, const CallGraph &CG) {
- WriteToOutput(CG, o); return o;
-}
-
-void WriteToOutput(const CallGraphNode *, std::ostream &o);
-inline std::ostream &operator <<(std::ostream &o, const CallGraphNode *CGN) {
- WriteToOutput(CGN, o); return o;
-}
-
#endif
FunctionMap.clear();
}
-
-void WriteToOutput(const CallGraphNode *CGN, std::ostream &o) {
+static void WriteToOutput(const CallGraphNode *CGN, std::ostream &o) {
if (CGN->getFunction())
o << "Call graph node for function: '"
<< CGN->getFunction()->getName() <<"'\n";
o << "\n";
}
-void WriteToOutput(const CallGraph &CG, std::ostream &o) {
- o << "CallGraph Root is:\n" << CG.getRoot();
+void CallGraph::print(std::ostream &o, const Module *M) const {
+ o << "CallGraph Root is:\n" << getRoot();
- for (CallGraph::const_iterator I = CG.begin(), E = CG.end(); I != E; ++I)
- o << I->second;
+ for (CallGraph::const_iterator I = begin(), E = end(); I != E; ++I)
+ WriteToOutput(I->second, o);
}