[Analyzer] Don't inherit from FoldingSet.
authorBenjamin Kramer <benny.kra@googlemail.com>
Sun, 22 Mar 2015 18:16:22 +0000 (18:16 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sun, 22 Mar 2015 18:16:22 +0000 (18:16 +0000)
That's not really necessary here. NFCI.

llvm-svn: 232921

clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp

index ce4dfb2..a5a9834 100644 (file)
@@ -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);
index e2102fb..c490031 100644 (file)
@@ -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<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::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;