summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Analysis')
-rw-r--r--clang/lib/Analysis/CallGraph.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Analysis/CallGraph.cpp b/clang/lib/Analysis/CallGraph.cpp
index 79519d75123..ca73c4a1611 100644
--- a/clang/lib/Analysis/CallGraph.cpp
+++ b/clang/lib/Analysis/CallGraph.cpp
@@ -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;
}
OpenPOWER on IntegriCloud