r232921 - [Analyzer] Don't inherit from FoldingSet.
Benjamin Kramer
benny.kra at googlemail.com
Sun Mar 22 11:16:22 PDT 2015
Author: d0k
Date: Sun Mar 22 13:16:22 2015
New Revision: 232921
URL: http://llvm.org/viewvc/llvm-project?rev=232921&view=rev
Log:
[Analyzer] Don't inherit from FoldingSet.
That's not really necessary here. NFCI.
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=232921&r1=232920&r2=232921&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h Sun Mar 22 13:16:22 2015
@@ -70,11 +70,15 @@ public:
void Profile(llvm::FoldingSetNodeID &ID) { ID = NodeID; }
};
- struct FilesMade : public llvm::FoldingSet<PDFileEntry> {
+ class FilesMade {
llvm::BumpPtrAllocator Alloc;
+ llvm::FoldingSet<PDFileEntry> Set;
+ public:
~FilesMade();
+ bool empty() const { return Set.empty(); }
+
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=232921&r1=232920&r2=232921&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp Sun Mar 22 13:16:22 2015
@@ -456,7 +456,7 @@ void PathDiagnosticConsumer::FlushDiagno
}
PathDiagnosticConsumer::FilesMade::~FilesMade() {
- for (PDFileEntry &Entry : *this)
+ for (PDFileEntry &Entry : Set)
Entry.~PDFileEntry();
}
@@ -466,11 +466,11 @@ void PathDiagnosticConsumer::FilesMade::
llvm::FoldingSetNodeID NodeID;
NodeID.Add(PD);
void *InsertPos;
- PDFileEntry *Entry = FindNodeOrInsertPos(NodeID, InsertPos);
+ PDFileEntry *Entry = Set.FindNodeOrInsertPos(NodeID, InsertPos);
if (!Entry) {
Entry = Alloc.Allocate<PDFileEntry>();
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::getFi
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;
More information about the cfe-commits
mailing list