aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2008-09-19 07:57:09 +0000
committerDuncan Sands <baldrick@free.fr>2008-09-19 07:57:09 +0000
commite65d39a42ccb63c8b883db0c466cc43f42d83fff (patch)
tree5ac155673b708efe3891cab768e0e1e6f72b580d
parentfa48f941304f29f967e0a7fc6807d7026ba99b7b (diff)
Teach -callgraph to always print the callgraph (as the
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
-rw-r--r--test/Analysis/CallGraph/2008-09-09-DirectCall.ll2
-rw-r--r--test/Analysis/CallGraph/2008-09-09-UsedByGlobal.ll2
-rw-r--r--test/Other/2002-01-31-CallGraph.ll2
-rw-r--r--tools/opt/AnalysisWrappers.cpp11
4 files changed, 8 insertions, 9 deletions
diff --git a/test/Analysis/CallGraph/2008-09-09-DirectCall.ll b/test/Analysis/CallGraph/2008-09-09-DirectCall.ll
index 4f090d5af3..a3afc379c5 100644
--- a/test/Analysis/CallGraph/2008-09-09-DirectCall.ll
+++ b/test/Analysis/CallGraph/2008-09-09-DirectCall.ll
@@ -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:
diff --git a/test/Analysis/CallGraph/2008-09-09-UsedByGlobal.ll b/test/Analysis/CallGraph/2008-09-09-UsedByGlobal.ll
index e37e112f34..8e6e5d2839 100644
--- a/test/Analysis/CallGraph/2008-09-09-UsedByGlobal.ll
+++ b/test/Analysis/CallGraph/2008-09-09-UsedByGlobal.ll
@@ -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]
diff --git a/test/Other/2002-01-31-CallGraph.ll b/test/Other/2002-01-31-CallGraph.ll
index e09461dc2a..da638d8394 100644
--- a/test/Other/2002-01-31-CallGraph.ll
+++ b/test/Other/2002-01-31-CallGraph.ll
@@ -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)
diff --git a/tools/opt/AnalysisWrappers.cpp b/tools/opt/AnalysisWrappers.cpp
index dcc8dbb49e..454e73872e 100644
--- a/tools/opt/AnalysisWrappers.cpp
+++ b/tools/opt/AnalysisWrappers.cpp
@@ -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");