Delete the CollectorNamePool if it should become empty.
authorGordon Henriksen <gordonhenriksen@mac.com>
Mon, 10 Dec 2007 03:35:18 +0000 (03:35 +0000)
committerGordon Henriksen <gordonhenriksen@mac.com>
Mon, 10 Dec 2007 03:35:18 +0000 (03:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44775 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/StringPool.h
lib/VMCore/Function.cpp

index 7ac2b147c34dc7eb54c0ff355f1166cb676a3ce5..46087e4d1febaa15c2eb8707013b7549a4b43199 100644 (file)
@@ -70,6 +70,10 @@ namespace llvm {
     /// reference-counted pointer to it. No additional memory is allocated if
     /// the string already exists in the pool.
     inline PooledStringPtr intern(const char *Str);
+    
+    /// empty - Checks whether the pool is empty. Returns true if so.
+    /// 
+    inline bool empty() const { return InternTable.empty(); }
   };
   
   /// PooledStringPtr - A pointer to an interned string. Use operator bool to
index 18effea50916d1a5c4fc24547afed2c101074637..856385bb0082fb96a0d176929baaa6429e7dfea6 100644 (file)
@@ -414,6 +414,10 @@ void Function::clearCollector() {
     if (CollectorNames->empty()) {
       delete CollectorNames;
       CollectorNames = 0;
+      if (CollectorNamePool->empty()) {
+        delete CollectorNamePool;
+        CollectorNamePool = 0;
+      }
     }
   }
 }