diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-08-29 20:06:10 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-08-29 20:06:10 +0000 |
commit | c9950cb1dda4c9f192124669120ec69c06d35311 (patch) | |
tree | eaf31465a114e8f58e3e70860da6a805e48ad57d /clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp | |
parent | d5478fdd8f054ceff9c64636c4ac65a256fcd69a (diff) | |
download | bcm5719-llvm-c9950cb1dda4c9f192124669120ec69c06d35311.tar.gz bcm5719-llvm-c9950cb1dda4c9f192124669120ec69c06d35311.zip |
unique_ptrify PathDiagnosticConsumer::HandlePathDiagnostic
FoldingSet, another intrusive data structure that could use some
unique_ptr love on its interfaces. Eventually.
llvm-svn: 216764
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp b/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp index fd25bd8e3af..b971fff642d 100644 --- a/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp +++ b/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp @@ -197,9 +197,8 @@ PathDiagnosticConsumer::~PathDiagnosticConsumer() { } } -void PathDiagnosticConsumer::HandlePathDiagnostic(PathDiagnostic *D) { - std::unique_ptr<PathDiagnostic> OwningD(D); - +void PathDiagnosticConsumer::HandlePathDiagnostic( + std::unique_ptr<PathDiagnostic> D) { if (!D || D->path.empty()) return; @@ -213,7 +212,7 @@ void PathDiagnosticConsumer::HandlePathDiagnostic(PathDiagnostic *D) { if (!supportsCrossFileDiagnostics()) { // Verify that the entire path is from the same FileID. FileID FID; - const SourceManager &SMgr = (*D->path.begin())->getLocation().getManager(); + const SourceManager &SMgr = D->path.front()->getLocation().getManager(); SmallVector<const PathPieces *, 5> WorkList; WorkList.push_back(&D->path); @@ -272,12 +271,12 @@ void PathDiagnosticConsumer::HandlePathDiagnostic(PathDiagnostic *D) { if (orig_size <= new_size) return; - assert(orig != D); + assert(orig != D.get()); Diags.RemoveNode(orig); delete orig; } - Diags.InsertNode(OwningD.release()); + Diags.InsertNode(D.release()); } static Optional<bool> comparePath(const PathPieces &X, const PathPieces &Y); |