summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/CallGraph.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-07-21 00:07:06 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-07-21 00:07:06 +0000
commit05ac8276cfc37ac89bb46551e1aa7617295ab341 (patch)
tree52b23e8ce8cd01437a93042cbd02baf559e01a80 /clang/lib/Analysis/CallGraph.cpp
parented73cac647942fb08c052d466e054027a7790d63 (diff)
downloadbcm5719-llvm-05ac8276cfc37ac89bb46551e1aa7617295ab341.tar.gz
bcm5719-llvm-05ac8276cfc37ac89bb46551e1aa7617295ab341.zip
Change the semantics for Entity.
Entity can now refer to declarations that are not visible outside the translation unit. It is a wrapper of a pointer union, it's either a Decl* for declarations that don't "cross" translation units, or an EntityImpl* which is associated with the specific "visible" Decl. Included is a test case for handling fields across translation units. llvm-svn: 76515
Diffstat (limited to 'clang/lib/Analysis/CallGraph.cpp')
-rw-r--r--clang/lib/Analysis/CallGraph.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/Analysis/CallGraph.cpp b/clang/lib/Analysis/CallGraph.cpp
index cf8f6205abe..2530fc0ad74 100644
--- a/clang/lib/Analysis/CallGraph.cpp
+++ b/clang/lib/Analysis/CallGraph.cpp
@@ -25,12 +25,12 @@ class CGBuilder : public StmtVisitor<CGBuilder> {
CallGraph &G;
FunctionDecl *FD;
- Entity *CallerEnt;
+ Entity CallerEnt;
CallGraphNode *CallerNode;
public:
- CGBuilder(CallGraph &g, FunctionDecl *fd, Entity *E, CallGraphNode *N)
+ CGBuilder(CallGraph &g, FunctionDecl *fd, Entity E, CallGraphNode *N)
: G(g), FD(fd), CallerEnt(E), CallerNode(N) {}
void VisitStmt(Stmt *S) { VisitChildren(S); }
@@ -47,7 +47,7 @@ public:
void CGBuilder::VisitCallExpr(CallExpr *CE) {
if (FunctionDecl *CalleeDecl = CE->getDirectCallee()) {
- Entity *Ent = Entity::get(CalleeDecl, G.getProgram());
+ Entity Ent = Entity::get(CalleeDecl, G.getProgram());
CallGraphNode *CalleeNode = G.getOrInsertFunction(Ent);
Decl *Parent = ASTLocation::FindImmediateParent(FD, CE);
@@ -75,7 +75,7 @@ void CallGraph::addTU(ASTUnit &AST) {
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(*I)) {
if (FD->isThisDeclarationADefinition()) {
// Set caller's ASTContext.
- Entity *Ent = Entity::get(FD, Prog);
+ Entity Ent = Entity::get(FD, Prog);
CallGraphNode *Node = getOrInsertFunction(Ent);
CallerCtx[Node] = &Ctx;
@@ -86,7 +86,7 @@ void CallGraph::addTU(ASTUnit &AST) {
}
}
-CallGraphNode *CallGraph::getOrInsertFunction(Entity *F) {
+CallGraphNode *CallGraph::getOrInsertFunction(Entity F) {
CallGraphNode *&Node = FunctionMap[F];
if (Node)
return Node;
@@ -98,7 +98,7 @@ void CallGraph::print(llvm::raw_ostream &os) {
for (iterator I = begin(), E = end(); I != E; ++I) {
if (I->second->hasCallee()) {
ASTContext &Ctx = *CallerCtx[I->second];
- os << "function: " << I->first->getPrintableName(Ctx).c_str()
+ os << "function: " << I->first.getPrintableName(Ctx).c_str()
<< " calls:\n";
for (CallGraphNode::iterator CI = I->second->begin(),
CE = I->second->end(); CI != CE; ++CI) {
OpenPOWER on IntegriCloud