diff options
| author | David Blaikie <dblaikie@gmail.com> | 2014-09-05 00:04:19 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2014-09-05 00:04:19 +0000 |
| commit | b564d1fb436d6a4bb1679420d01cef27ac7f5ec6 (patch) | |
| tree | 7102ed7bc574df6c0f1fb1686877d1569951f17c | |
| parent | 7c7d7b92df3280e9840652de51f94f98e739c07b (diff) | |
| download | bcm5719-llvm-b564d1fb436d6a4bb1679420d01cef27ac7f5ec6.tar.gz bcm5719-llvm-b564d1fb436d6a4bb1679420d01cef27ac7f5ec6.zip | |
unique_ptrify ExplodedGraph::trim
llvm-svn: 217208
| -rw-r--r-- | clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h | 11 | ||||
| -rw-r--r-- | clang/lib/StaticAnalyzer/Core/BugReporter.cpp | 2 | ||||
| -rw-r--r-- | clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp | 6 |
3 files changed, 10 insertions, 9 deletions
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h index 209073cb5e9..c4eabb8c2ac 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h @@ -297,8 +297,8 @@ public: bool IsSink = false, bool* IsNew = nullptr); - ExplodedGraph* MakeEmptyGraph() const { - return new ExplodedGraph(); + std::unique_ptr<ExplodedGraph> MakeEmptyGraph() const { + return llvm::make_unique<ExplodedGraph>(); } /// addRoot - Add an untyped node to the set of roots. @@ -372,9 +372,10 @@ public: /// \param[out] InverseMap An optional map from nodes in the returned graph to /// nodes in this graph. /// \returns The trimmed graph - ExplodedGraph *trim(ArrayRef<const NodeTy *> Nodes, - InterExplodedGraphMap *ForwardMap = nullptr, - InterExplodedGraphMap *InverseMap = nullptr) const; + std::unique_ptr<ExplodedGraph> + trim(ArrayRef<const NodeTy *> Nodes, + InterExplodedGraphMap *ForwardMap = nullptr, + InterExplodedGraphMap *InverseMap = nullptr) const; /// Enable tracking of recently allocated nodes for potential reclamation /// when calling reclaimRecentlyAllocatedNodes(). diff --git a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp index fae22be1b68..342c4e66d7d 100644 --- a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp +++ b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp @@ -2856,7 +2856,7 @@ TrimmedGraph::TrimmedGraph(const ExplodedGraph *OriginalGraph, // The trimmed graph is created in the body of the constructor to ensure // that the DenseMaps have been initialized already. InterExplodedGraphMap ForwardMap; - G.reset(OriginalGraph->trim(Nodes, &ForwardMap, &InverseMap)); + G = OriginalGraph->trim(Nodes, &ForwardMap, &InverseMap); // Find the (first) error node in the trimmed graph. We just need to consult // the node map which maps from nodes in the original graph to nodes diff --git a/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp b/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp index 1c9a282b829..c0bc902c490 100644 --- a/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp @@ -336,10 +336,10 @@ ExplodedNode *ExplodedGraph::getNode(const ProgramPoint &L, return V; } -ExplodedGraph * +std::unique_ptr<ExplodedGraph> ExplodedGraph::trim(ArrayRef<const NodeTy *> Sinks, InterExplodedGraphMap *ForwardMap, - InterExplodedGraphMap *InverseMap) const{ + InterExplodedGraphMap *InverseMap) const { if (Nodes.empty()) return nullptr; @@ -388,7 +388,7 @@ ExplodedGraph::trim(ArrayRef<const NodeTy *> Sinks, return nullptr; // Create an empty graph. - ExplodedGraph* G = MakeEmptyGraph(); + std::unique_ptr<ExplodedGraph> G = MakeEmptyGraph(); // ===- Pass 2 (forward DFS to construct the new graph) -=== while (!WL2.empty()) { |

