]> granicus.if.org Git - clang/commitdiff
Call Graph: Only the root node is allowed to have an invalid Decl*.
authorAnna Zaks <ganna@apple.com>
Thu, 8 Mar 2012 23:16:26 +0000 (23:16 +0000)
committerAnna Zaks <ganna@apple.com>
Thu, 8 Mar 2012 23:16:26 +0000 (23:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152350 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/CallGraph.cpp

index 79519d751230c9dc73f121fd4536945f3459f496..ca73c4a161103d7825febe97eb59d0fd6fab8ee4 100644 (file)
@@ -87,6 +87,7 @@ CallGraph::~CallGraph() {
 }
 
 void CallGraph::addToCallGraph(Decl* D, bool IsGlobal) {
+  assert(D);
   CallGraphNode *Node = getOrInsertFunction(D);
 
   if (IsGlobal)
@@ -141,7 +142,9 @@ CallGraphNode *CallGraph::getOrInsertFunction(Decl *F) {
     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;
 }