diff options
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Analysis/CallGraph.cpp')
-rw-r--r-- | contrib/llvm/tools/clang/lib/Analysis/CallGraph.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/contrib/llvm/tools/clang/lib/Analysis/CallGraph.cpp b/contrib/llvm/tools/clang/lib/Analysis/CallGraph.cpp index 9d522fe..8c126b0 100644 --- a/contrib/llvm/tools/clang/lib/Analysis/CallGraph.cpp +++ b/contrib/llvm/tools/clang/lib/Analysis/CallGraph.cpp @@ -55,7 +55,7 @@ public: void addCalledDecl(Decl *D) { if (G->includeInGraph(D)) { CallGraphNode *CalleeNode = G->getOrInsertNode(D); - CallerNode->addCallee(CalleeNode, G); + CallerNode->addCallee(CalleeNode); } } @@ -104,9 +104,7 @@ CallGraph::CallGraph() { Root = getOrInsertNode(nullptr); } -CallGraph::~CallGraph() { - llvm::DeleteContainerSeconds(FunctionMap); -} +CallGraph::~CallGraph() {} bool CallGraph::includeInGraph(const Decl *D) { assert(D); @@ -142,22 +140,22 @@ void CallGraph::addNodeForDecl(Decl* D, bool IsGlobal) { CallGraphNode *CallGraph::getNode(const Decl *F) const { FunctionMapTy::const_iterator I = FunctionMap.find(F); if (I == FunctionMap.end()) return nullptr; - return I->second; + return I->second.get(); } CallGraphNode *CallGraph::getOrInsertNode(Decl *F) { if (F && !isa<ObjCMethodDecl>(F)) F = F->getCanonicalDecl(); - CallGraphNode *&Node = FunctionMap[F]; + std::unique_ptr<CallGraphNode> &Node = FunctionMap[F]; if (Node) - return Node; + return Node.get(); - Node = new CallGraphNode(F); + Node = llvm::make_unique<CallGraphNode>(F); // Make Root node a parent of all functions to make sure all are reachable. if (F) - Root->addCallee(Node, this); - return Node; + Root->addCallee(Node.get()); + return Node.get(); } void CallGraph::print(raw_ostream &OS) const { |