Teach -callgraph to always print the callgraph (as the
authorDuncan Sands <baldrick@free.fr>
Fri, 19 Sep 2008 07:57:09 +0000 (07:57 +0000)
committerDuncan Sands <baldrick@free.fr>
Fri, 19 Sep 2008 07:57:09 +0000 (07:57 +0000)
description says it does), not just when -analyze is
used as well.  This means printing to stderr, so adjust
some tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56337 91177308-0d34-0410-b5e6-96231b3b80d8

test/Analysis/CallGraph/2008-09-09-DirectCall.ll
test/Analysis/CallGraph/2008-09-09-UsedByGlobal.ll
test/Other/2002-01-31-CallGraph.ll
tools/opt/AnalysisWrappers.cpp

index 4f090d5af36659cc80d5a8544684d01874988a5d..a3afc379c5a6880204f4bc578680d9b752c47116 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -analyze -callgraph -disable-output | grep {Calls function 'callee'} | count 2
+; RUN: llvm-as < %s | opt -callgraph -disable-output |& grep {Calls function 'callee'} | count 2
 
 define internal void @callee(...) {
 entry:
index e37e112f3414b15786691c9ca0259905619ad6cd..8e6e5d2839433aee960e9dc0526f96f7eee8bea7 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -analyze -callgraph -disable-output | grep {Calls function}
+; RUN: llvm-as < %s | opt -callgraph -disable-output |& grep {Calls function}
 
 @a = global void ()* @f                ; <void ()**> [#uses=0]
 
index e09461dc2acb0767a527ce3b0b24c1237523009f..da638d8394c475d8e23a6d95135532bfb0a76e35 100644 (file)
@@ -1,6 +1,6 @@
 ;  Call graph construction crash: Not handling indirect calls right
 ;
-; RUN: llvm-as < %s | opt -analyze -callgraph
+; RUN: llvm-as < %s | opt -analyze -callgraph >& /dev/null
 ;
 
         %FunTy = type i32 (i32)
index dcc8dbb49efa8b34005a75da7913e694457ca65d..454e73872ea60f4382171d22eb477a203240c136 100644 (file)
@@ -66,7 +66,7 @@ namespace {
   char ExternalFunctionsPassedConstants::ID = 0;
   RegisterPass<ExternalFunctionsPassedConstants>
   P1("externalfnconstants", "Print external fn callsites passed constants");
-  
+
   struct CallGraphPrinter : public ModulePass {
     static char ID; // Pass ID, replacement for typeid
     CallGraphPrinter() : ModulePass((intptr_t)&ID) {}
@@ -75,13 +75,12 @@ namespace {
       AU.setPreservesAll();
       AU.addRequiredTransitive<CallGraph>();
     }
-    virtual bool runOnModule(Module &M) { return false; }
-
-    virtual void print(std::ostream &OS, const Module *M) const {
-      getAnalysis<CallGraph>().print(OS, M);
+    virtual bool runOnModule(Module &M) {
+      getAnalysis<CallGraph>().print(std::cerr, &M);
+      return false;
     }
   };
-  
+
   char CallGraphPrinter::ID = 0;
   RegisterPass<CallGraphPrinter>
     P2("callgraph", "Print a call graph");