зеркало из https://github.com/microsoft/clang-1.git
make CallGraph more flexible by letting it accept ASTContext instead of ASTUnit.
Patch by Simone Pellegrini. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85386 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
67665869cc
Коммит
f20288c916
|
@ -17,7 +17,6 @@
|
|||
#include "clang/Index/ASTLocation.h"
|
||||
#include "clang/Index/Entity.h"
|
||||
#include "clang/Index/Program.h"
|
||||
#include "clang/Frontend/ASTUnit.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/GraphTraits.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
|
@ -87,7 +86,7 @@ public:
|
|||
|
||||
CallGraphNode *getExternalCallingNode() { return ExternalCallingNode; }
|
||||
|
||||
void addTU(ASTUnit &AST);
|
||||
void addTU(ASTContext &AST);
|
||||
|
||||
idx::Program &getProgram() { return Prog; }
|
||||
|
||||
|
|
|
@ -68,10 +68,8 @@ CallGraph::~CallGraph() {
|
|||
}
|
||||
}
|
||||
|
||||
void CallGraph::addTU(ASTUnit &AST) {
|
||||
ASTContext &Ctx = AST.getASTContext();
|
||||
void CallGraph::addTU(ASTContext& Ctx) {
|
||||
DeclContext *DC = Ctx.getTranslationUnitDecl();
|
||||
|
||||
for (DeclContext::decl_iterator I = DC->decls_begin(), E = DC->decls_end();
|
||||
I != E; ++I) {
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/Analysis/CallGraph.h"
|
||||
|
||||
#include "clang/Frontend/ASTUnit.h"
|
||||
#include "clang/Basic/FileManager.h"
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
#include "clang/Frontend/TextDiagnosticBuffer.h"
|
||||
|
@ -56,7 +56,7 @@ int main(int argc, char **argv) {
|
|||
CG.reset(new CallGraph());
|
||||
|
||||
for (unsigned i = 0, e = ASTUnits.size(); i != e; ++i)
|
||||
CG->addTU(*ASTUnits[i]);
|
||||
CG->addTU(ASTUnits[i]->getASTContext());
|
||||
|
||||
CG->ViewCallGraph();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче