[cfe-commits] r85386 - in /cfe/trunk: include/clang/Analysis/CallGraph.h lib/Analysis/CallGraph.cpp tools/wpa/clang-wpa.cpp
Zhongxing Xu
xuzhongxing at gmail.com
Wed Oct 28 05:23:04 PDT 2009
Author: zhongxingxu
Date: Wed Oct 28 07:23:03 2009
New Revision: 85386
URL: http://llvm.org/viewvc/llvm-project?rev=85386&view=rev
Log:
make CallGraph more flexible by letting it accept ASTContext instead of ASTUnit.
Patch by Simone Pellegrini.
Modified:
cfe/trunk/include/clang/Analysis/CallGraph.h
cfe/trunk/lib/Analysis/CallGraph.cpp
cfe/trunk/tools/wpa/clang-wpa.cpp
Modified: cfe/trunk/include/clang/Analysis/CallGraph.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/CallGraph.h?rev=85386&r1=85385&r2=85386&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/CallGraph.h (original)
+++ cfe/trunk/include/clang/Analysis/CallGraph.h Wed Oct 28 07:23:03 2009
@@ -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 @@
CallGraphNode *getExternalCallingNode() { return ExternalCallingNode; }
- void addTU(ASTUnit &AST);
+ void addTU(ASTContext &AST);
idx::Program &getProgram() { return Prog; }
Modified: cfe/trunk/lib/Analysis/CallGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CallGraph.cpp?rev=85386&r1=85385&r2=85386&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CallGraph.cpp (original)
+++ cfe/trunk/lib/Analysis/CallGraph.cpp Wed Oct 28 07:23:03 2009
@@ -68,10 +68,8 @@
}
}
-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) {
Modified: cfe/trunk/tools/wpa/clang-wpa.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/wpa/clang-wpa.cpp?rev=85386&r1=85385&r2=85386&view=diff
==============================================================================
--- cfe/trunk/tools/wpa/clang-wpa.cpp (original)
+++ cfe/trunk/tools/wpa/clang-wpa.cpp Wed Oct 28 07:23:03 2009
@@ -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 @@
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();
}
More information about the cfe-commits
mailing list