aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure/Printer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis/DataStructure/Printer.cpp')
-rw-r--r--lib/Analysis/DataStructure/Printer.cpp6
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