From 3116c4e5cdfa26ff9e3c73d3732b72c48f97096e Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Wed, 8 Feb 2012 04:32:27 +0000 Subject: Refactor pieces of PathDiagnostic into its own data structure. No functionality change. llvm-svn: 150053 --- .../clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h | 8 +++++++- clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp | 6 ++++-- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'clang') diff --git a/clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h b/clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h index 9516fcea83c..08b48e529bb 100644 --- a/clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h +++ b/clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h @@ -44,6 +44,12 @@ class ExplodedNode; //===----------------------------------------------------------------------===// class PathDiagnostic; +class PathDiagnosticPiece; + +class PathPieces : public std::deque { +public: + ~PathPieces(); +}; class PathDiagnosticConsumer { virtual void anchor(); @@ -475,7 +481,7 @@ public: /// diagnostic. It represents an ordered-collection of PathDiagnosticPieces, /// each which represent the pieces of the path. class PathDiagnostic : public llvm::FoldingSetNode { - std::deque path; + PathPieces path; unsigned Size; std::string BugType; std::string Desc; diff --git a/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp b/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp index 0d2c2e82d97..bdf2e16a4be 100644 --- a/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp +++ b/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp @@ -62,10 +62,12 @@ PathDiagnosticMacroPiece::~PathDiagnosticMacroPiece() { PathDiagnostic::PathDiagnostic() : Size(0) {} -PathDiagnostic::~PathDiagnostic() { - for (iterator I = begin(), E = end(); I != E; ++I) delete &*I; +PathPieces::~PathPieces() { + for (iterator I = begin(), E = end(); I != E; ++I) delete *I; } +PathDiagnostic::~PathDiagnostic() {} + void PathDiagnostic::resetPath(bool deletePieces) { Size = 0; -- cgit v1.2.3