diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2010-07-02 06:58:30 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2010-07-02 06:58:30 +0000 |
commit | 9b80ceba0f930f84731c2b8c1df43f66cba762d0 (patch) | |
tree | a612c30ebed1f4edfcc28990232d4ba1ba53a160 /examples | |
parent | 6d956dfcc79159808f46493dc5754971c76593aa (diff) |
add -view-call-graph option to wpa.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107462 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'examples')
-rw-r--r-- | examples/wpa/clang-wpa.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/examples/wpa/clang-wpa.cpp b/examples/wpa/clang-wpa.cpp index c75626dab5..04a706e0a0 100644 --- a/examples/wpa/clang-wpa.cpp +++ b/examples/wpa/clang-wpa.cpp @@ -26,6 +26,9 @@ using namespace idx; static llvm::cl::list<std::string> InputFilenames(llvm::cl::Positional, llvm::cl::desc("<input AST files>")); +static llvm::cl::opt<bool> ViewCallGraph("view-call-graph", + llvm::cl::desc("Display the call graph.")); + int main(int argc, char **argv) { llvm::cl::ParseCommandLineOptions(argc, argv, "clang-wpa"); FileManager FileMgr; @@ -48,11 +51,14 @@ int main(int argc, char **argv) { ASTUnits.push_back(AST.take()); } - llvm::OwningPtr<CallGraph> CG; - CG.reset(new CallGraph(Prog)); + if (ViewCallGraph) { + llvm::OwningPtr<CallGraph> CG; + CG.reset(new CallGraph(Prog)); - for (unsigned i = 0, e = ASTUnits.size(); i != e; ++i) - CG->addTU(ASTUnits[i]->getASTContext()); + for (unsigned i = 0, e = ASTUnits.size(); i != e; ++i) + CG->addTU(ASTUnits[i]->getASTContext()); - CG->ViewCallGraph(); + CG->ViewCallGraph(); + return 0; + } } |