r207902 - [leaks] The PDFileEntry nodes in the FilesMade FoldingSet contain
Chandler Carruth
chandlerc at gmail.com
Sat May 3 03:39:05 PDT 2014
Author: chandlerc
Date: Sat May 3 05:39:05 2014
New Revision: 207902
URL: http://llvm.org/viewvc/llvm-project?rev=207902&view=rev
Log:
[leaks] The PDFileEntry nodes in the FilesMade FoldingSet contain
a std::vector that allocates on the heap. As a consequence, we have to
run all of their destructors when tearing down the set, not just
deallocate the memory blobs.
Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h?rev=207902&r1=207901&r2=207902&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h Sat May 3 05:39:05 2014
@@ -72,7 +72,9 @@ public:
struct FilesMade : public llvm::FoldingSet<PDFileEntry> {
llvm::BumpPtrAllocator Alloc;
-
+
+ ~FilesMade();
+
void addDiagnostic(const PathDiagnostic &PD,
StringRef ConsumerName,
StringRef fileName);
Modified: cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp?rev=207902&r1=207901&r2=207902&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp Sat May 3 05:39:05 2014
@@ -451,6 +451,11 @@ void PathDiagnosticConsumer::FlushDiagno
Diags.clear();
}
+PathDiagnosticConsumer::FilesMade::~FilesMade() {
+ for (PDFileEntry &Entry : *this)
+ Entry.~PDFileEntry();
+}
+
void PathDiagnosticConsumer::FilesMade::addDiagnostic(const PathDiagnostic &PD,
StringRef ConsumerName,
StringRef FileName) {
More information about the cfe-commits
mailing list