diff options
author | Chris Lattner <sabre@nondot.org> | 2003-02-04 00:03:18 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-02-04 00:03:18 +0000 |
commit | 714752fa8e133d76e23dce82822f0473331e5201 (patch) | |
tree | 645d5678f8f75e7cb31d98beed1a32c26cd756b6 /lib/Analysis/DataStructure/Printer.cpp | |
parent | 0a91e63d92130e11bb368d3a329da2cb8f374298 (diff) |
Fix printing of nonfunction graphs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5487 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/Printer.cpp')
-rw-r--r-- | lib/Analysis/DataStructure/Printer.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Analysis/DataStructure/Printer.cpp b/lib/Analysis/DataStructure/Printer.cpp index dae4a3ac2f..b6b843b345 100644 --- a/lib/Analysis/DataStructure/Printer.cpp +++ b/lib/Analysis/DataStructure/Printer.cpp @@ -29,7 +29,7 @@ void DSNode::dump() const { print(std::cerr, 0); } static std::string getCaption(const DSNode *N, const DSGraph *G) { std::stringstream OS; - Module *M = G && &G->getFunction() ? G->getFunction().getParent() : 0; + Module *M = G && G->hasFunction() ? G->getFunction().getParent() : 0; if (N->isNodeCompletelyFolded()) OS << "FOLDED"; @@ -86,13 +86,15 @@ struct DOTGraphTraits<const DSGraph*> : public DefaultDOTGraphTraits { /// static void addCustomGraphFeatures(const DSGraph *G, GraphWriter<const DSGraph*> &GW) { + Module *CurMod = G->hasFunction() ? G->getFunction().getParent() : 0; + // Add scalar nodes to the graph... const hash_map<Value*, DSNodeHandle> &VM = G->getScalarMap(); for (hash_map<Value*, DSNodeHandle>::const_iterator I = VM.begin(); I != VM.end(); ++I) if (!isa<GlobalValue>(I->first)) { std::stringstream OS; - WriteAsOperand(OS, I->first, false, true, G->getFunction().getParent()); + WriteAsOperand(OS, I->first, false, true, CurMod); GW.emitSimpleNode(I->first, "", OS.str()); // Add edge from return node to real destination |