Simplify some getNode calls.
[oota-llvm.git] / tools / opt / GraphPrinters.cpp
index 8826cd2a777dce8cc83bae9e0714609c26ad4836..867e33480879aafa2ab511d24ac8ab1115076404 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
@@ -18,6 +18,7 @@
 #include "llvm/Pass.h"
 #include "llvm/Value.h"
 #include "llvm/Analysis/CallGraph.h"
+#include <iostream>
 #include <fstream>
 using namespace llvm;
 
@@ -59,12 +60,16 @@ namespace llvm {
 
 namespace {
   struct CallGraphPrinter : public ModulePass {
+    static char ID; // Pass ID, replacement for typeid
+    CallGraphPrinter() : ModulePass((intptr_t)&ID) {}
+
     virtual bool runOnModule(Module &M) {
       WriteGraphToFile(std::cerr, "callgraph", &getAnalysis<CallGraph>());
       return false;
     }
 
     void print(std::ostream &OS) const {}
+    void print(std::ostream &OS, const llvm::Module*) const {}
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.addRequired<CallGraph>();
@@ -72,6 +77,7 @@ namespace {
     }
   };
 
-  RegisterAnalysis<CallGraphPrinter> P2("print-callgraph",
-                                        "Print Call Graph to 'dot' file");
+  char CallGraphPrinter::ID = 0;
+  RegisterPass<CallGraphPrinter> P2("print-callgraph",
+                                    "Print Call Graph to 'dot' file");
 }