From 9f937001b37987743ef5b2e2ffc3d777c384b541 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sun, 22 Mar 2015 18:16:22 +0000 Subject: [PATCH] [Analyzer] Don't inherit from FoldingSet. That's not really necessary here. NFCI. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232921 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../StaticAnalyzer/Core/BugReporter/PathDiagnostic.h | 6 +++++- lib/StaticAnalyzer/Core/PathDiagnostic.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h b/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h index ce4dfb248f..a5a98343f6 100644 --- a/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h +++ b/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h @@ -70,11 +70,15 @@ public: void Profile(llvm::FoldingSetNodeID &ID) { ID = NodeID; } }; - struct FilesMade : public llvm::FoldingSet { + class FilesMade { llvm::BumpPtrAllocator Alloc; + llvm::FoldingSet Set; + public: ~FilesMade(); + bool empty() const { return Set.empty(); } + void addDiagnostic(const PathDiagnostic &PD, StringRef ConsumerName, StringRef fileName); diff --git a/lib/StaticAnalyzer/Core/PathDiagnostic.cpp b/lib/StaticAnalyzer/Core/PathDiagnostic.cpp index e2102fbc59..c4900313ca 100644 --- a/lib/StaticAnalyzer/Core/PathDiagnostic.cpp +++ b/lib/StaticAnalyzer/Core/PathDiagnostic.cpp @@ -456,7 +456,7 @@ void PathDiagnosticConsumer::FlushDiagnostics( } PathDiagnosticConsumer::FilesMade::~FilesMade() { - for (PDFileEntry &Entry : *this) + for (PDFileEntry &Entry : Set) Entry.~PDFileEntry(); } @@ -466,11 +466,11 @@ void PathDiagnosticConsumer::FilesMade::addDiagnostic(const PathDiagnostic &PD, llvm::FoldingSetNodeID NodeID; NodeID.Add(PD); void *InsertPos; - PDFileEntry *Entry = FindNodeOrInsertPos(NodeID, InsertPos); + PDFileEntry *Entry = Set.FindNodeOrInsertPos(NodeID, InsertPos); if (!Entry) { Entry = Alloc.Allocate(); Entry = new (Entry) PDFileEntry(NodeID); - InsertNode(Entry, InsertPos); + Set.InsertNode(Entry, InsertPos); } // Allocate persistent storage for the file name. @@ -487,7 +487,7 @@ PathDiagnosticConsumer::FilesMade::getFiles(const PathDiagnostic &PD) { llvm::FoldingSetNodeID NodeID; NodeID.Add(PD); void *InsertPos; - PDFileEntry *Entry = FindNodeOrInsertPos(NodeID, InsertPos); + PDFileEntry *Entry = Set.FindNodeOrInsertPos(NodeID, InsertPos); if (!Entry) return nullptr; return &Entry->files; -- 2.40.0