diff options
author | Justin Lebar <jlebar@google.com> | 2016-10-10 16:26:48 +0000 |
---|---|---|
committer | Justin Lebar <jlebar@google.com> | 2016-10-10 16:26:48 +0000 |
commit | 5f3d1dc44cf1d0d190ebb30a8b345581ba6dc869 (patch) | |
tree | 00245c81059e98d082f937869374b796af763dae /clang/lib/Analysis | |
parent | 5cb35e16766848ab29b2b00d74c222119b0edfbc (diff) | |
download | bcm5719-llvm-5f3d1dc44cf1d0d190ebb30a8b345581ba6dc869.tar.gz bcm5719-llvm-5f3d1dc44cf1d0d190ebb30a8b345581ba6dc869.zip |
[Analysis] Use unique_ptr for CallGraph::FunctionMap.
Reviewers: timshen
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D25427
llvm-svn: 283775
Diffstat (limited to 'clang/lib/Analysis')
-rw-r--r-- | clang/lib/Analysis/CallGraph.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/clang/lib/Analysis/CallGraph.cpp b/clang/lib/Analysis/CallGraph.cpp index 9d522fe7c6c..0cb5a3fe14e 100644 --- a/clang/lib/Analysis/CallGraph.cpp +++ b/clang/lib/Analysis/CallGraph.cpp @@ -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(), this); + return Node.get(); } void CallGraph::print(raw_ostream &OS) const { |