From: Chris Lattner Date: Tue, 4 Feb 2003 00:03:18 +0000 (+0000) Subject: Fix printing of nonfunction graphs X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=714752fa8e133d76e23dce82822f0473331e5201;p=oota-llvm.git Fix printing of nonfunction graphs git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5487 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/DataStructure/Printer.cpp b/lib/Analysis/DataStructure/Printer.cpp index dae4a3ac2fc..b6b843b3451 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 : public DefaultDOTGraphTraits { /// static void addCustomGraphFeatures(const DSGraph *G, GraphWriter &GW) { + Module *CurMod = G->hasFunction() ? G->getFunction().getParent() : 0; + // Add scalar nodes to the graph... const hash_map &VM = G->getScalarMap(); for (hash_map::const_iterator I = VM.begin(); I != VM.end(); ++I) if (!isa(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