]> granicus.if.org Git - clang/commitdiff
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232921 91177308-0d34-0410-b5e6-96231b3b80d8

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

index ce4dfb248fa8567651303eaa47843667b5ff5e16..a5a98343f612a4be4374d94da08848545ec0d3b9 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 e2102fbc598fc026ba9b57c6245d41617f17a61c..c4900313cad45670fb685693c05ba336fe2d49c3 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;