[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Printer.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Feb 3 18:04:01 PST 2003


Changes in directory llvm/lib/Analysis/DataStructure:

Printer.cpp updated: 1.45 -> 1.46

---
Log message:

Fix printing of nonfunction graphs


---
Diffs of the changes:

Index: llvm/lib/Analysis/DataStructure/Printer.cpp
diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.45 llvm/lib/Analysis/DataStructure/Printer.cpp:1.46
--- llvm/lib/Analysis/DataStructure/Printer.cpp:1.45	Sun Feb  2 10:42:01 2003
+++ llvm/lib/Analysis/DataStructure/Printer.cpp	Mon Feb  3 18:03:18 2003
@@ -29,7 +29,7 @@
 
 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 @@
   ///
   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





More information about the llvm-commits mailing list