Allow the call graph to be called from analyze naturally with print implemented

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4517 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2002-11-04 00:21:19 +00:00
parent c875f023d4
commit 1650015822
2 changed files with 11 additions and 23 deletions

View File

@ -130,8 +130,7 @@ void CallGraph::destroy() {
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";
@ -146,11 +145,11 @@ void WriteToOutput(const CallGraphNode *CGN, std::ostream &o) {
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);
}