From b474c04f4985af7138572b521ba19fdda012dc2f 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. llvm-svn: 232921 --- .../clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h | 6 +++++- clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h b/clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h index ce4dfb2..a5a9834 100644 --- a/clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h +++ b/clang/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/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp b/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp index e2102fb..c490031 100644 --- a/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp +++ b/clang/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.7.4