Remove the TranslationUnit usage from clang-wpa.cpp since it's not really

necessary.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77529 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Argyrios Kyrtzidis 2009-07-29 23:39:09 +00:00
Родитель 94431b5b4c
Коммит 0594545b5b
1 изменённых файлов: 4 добавлений и 16 удалений

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

@ -15,7 +15,6 @@
#include "clang/Analysis/CallGraph.h" #include "clang/Analysis/CallGraph.h"
#include "clang/Basic/FileManager.h" #include "clang/Basic/FileManager.h"
#include "clang/Index/TranslationUnit.h"
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
using namespace clang; using namespace clang;
@ -24,20 +23,10 @@ using namespace idx;
static llvm::cl::list<std::string> static llvm::cl::list<std::string>
InputFilenames(llvm::cl::Positional, llvm::cl::desc("<input AST files>")); InputFilenames(llvm::cl::Positional, llvm::cl::desc("<input AST files>"));
// FIXME: this duplicates the one in index-test.cpp.
class TUnit : public TranslationUnit {
public:
TUnit(ASTUnit *ast, const std::string &filename)
: AST(ast), Filename(filename) {}
ASTContext &getASTContext() { return AST->getASTContext(); }
llvm::OwningPtr<ASTUnit> AST;
std::string Filename;
};
int main(int argc, char **argv) { int main(int argc, char **argv) {
llvm::cl::ParseCommandLineOptions(argc, argv, "clang-wpa"); llvm::cl::ParseCommandLineOptions(argc, argv, "clang-wpa");
FileManager FileMgr; FileManager FileMgr;
std::vector<TUnit*> TUnits; std::vector<ASTUnit*> ASTUnits;
if (InputFilenames.empty()) if (InputFilenames.empty())
return 0; return 0;
@ -55,15 +44,14 @@ int main(int argc, char **argv) {
return 1; return 1;
} }
TUnit *TU = new TUnit(AST.take(), InFile); ASTUnits.push_back(AST.take());
TUnits.push_back(TU);
} }
llvm::OwningPtr<CallGraph> CG; llvm::OwningPtr<CallGraph> CG;
CG.reset(new CallGraph()); CG.reset(new CallGraph());
for (unsigned i = 0, e = TUnits.size(); i != e; ++i) for (unsigned i = 0, e = ASTUnits.size(); i != e; ++i)
CG->addTU(*(TUnits[i]->AST)); CG->addTU(*ASTUnits[i]);
CG->ViewCallGraph(); CG->ViewCallGraph();
} }