Call Graph: Only the root node is allowed to have an invalid Decl*.
llvm-svn: 152350
diff --git a/clang/lib/Analysis/CallGraph.cpp b/clang/lib/Analysis/CallGraph.cpp
index 79519d7..ca73c4a 100644
--- a/clang/lib/Analysis/CallGraph.cpp
+++ b/clang/lib/Analysis/CallGraph.cpp
@@ -87,6 +87,7 @@
}
void CallGraph::addToCallGraph(Decl* D, bool IsGlobal) {
+ assert(D);
CallGraphNode *Node = getOrInsertFunction(D);
if (IsGlobal)
@@ -141,7 +142,9 @@
return Node;
Node = new CallGraphNode(F);
- ParentlessNodes.insert(Node);
+ // If not root, add to the parentless list.
+ if (F != 0)
+ ParentlessNodes.insert(Node);
return Node;
}