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 | 4113571cd184b38c54b60362ec6b3d16f97786b8 (patch) | |
tree | e83b0553ddec5dcf953fa0a91ecd61fcbb70c3c7 /llvm/lib | |
parent | eededa396e4d5c0f90426b6dd42ff041ea682316 (diff) | |
download | bcm5719-llvm-4113571cd184b38c54b60362ec6b3d16f97786b8.tar.gz bcm5719-llvm-4113571cd184b38c54b60362ec6b3d16f97786b8.zip |
Fix printing of nonfunction graphs
llvm-svn: 5487
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Analysis/DataStructure/Printer.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/DataStructure/Printer.cpp b/llvm/lib/Analysis/DataStructure/Printer.cpp index dae4a3ac2fc..b6b843b3451 100644 --- a/llvm/lib/Analysis/DataStructure/Printer.cpp +++ b/llvm/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 |