add -view-call-graph option to wpa.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107462 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Zhongxing Xu 2010-07-02 06:58:30 +00:00
Родитель 6d956dfcc7
Коммит 9b80ceba0f
1 изменённых файлов: 11 добавлений и 5 удалений

Просмотреть файл

@ -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;
}
}