]> granicus.if.org Git - clang/commitdiff
Allocate 'ObjCMethodList' objects (owned by Sema) using Sema's BumpPtrAllocator....
authorTed Kremenek <kremenek@apple.com>
Thu, 11 Feb 2010 00:53:01 +0000 (00:53 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 11 Feb 2010 00:53:01 +0000 (00:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95834 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/PCHReader.cpp
lib/Sema/SemaDeclObjC.cpp

index 655d59fa8b2345e36fbf3282d7d0112fa07fc310..2a22132ea844138aaf60dd97259b7d9be2af16a2 100644 (file)
@@ -436,7 +436,9 @@ public:
         continue;
       }
 
-      Prev->Next = new ObjCMethodList(Method, 0);
+      ObjCMethodList *Mem =
+        Reader.getSema()->BumpAlloc.Allocate<ObjCMethodList>();
+      Prev->Next = new (Mem) ObjCMethodList(Method, 0);
       Prev = Prev->Next;
     }
 
@@ -452,7 +454,9 @@ public:
         continue;
       }
 
-      Prev->Next = new ObjCMethodList(Method, 0);
+      ObjCMethodList *Mem =
+        Reader.getSema()->BumpAlloc.Allocate<ObjCMethodList>();
+      Prev->Next = new (Mem) ObjCMethodList(Method, 0);
       Prev = Prev->Next;
     }
 
index 13eeb6c761a0fdd46f0be9e83a5b6e6f58d0a79f..af51fb10c16a5889bb2d5dcbac962f368426d20d 100644 (file)
@@ -1490,7 +1490,8 @@ void Sema::AddInstanceMethodToGlobalPool(ObjCMethodDecl *Method) {
 
   // We have a new signature for an existing method - add it.
   // This is extremely rare. Only 1% of Cocoa selectors are "overloaded".
-  Entry.Next = new ObjCMethodList(Method, Entry.Next);
+  ObjCMethodList *Mem = BumpAlloc.Allocate<ObjCMethodList>();
+  Entry.Next = new (Mem) ObjCMethodList(Method, Entry.Next);
 }
 
 // FIXME: Finish implementing -Wno-strict-selector-match.
@@ -1553,7 +1554,8 @@ void Sema::AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method) {
     if (!match) {
       // We have a new signature for an existing method - add it.
       // This is extremely rare. Only 1% of Cocoa selectors are "overloaded".
-      struct ObjCMethodList *OMI = new ObjCMethodList(Method, FirstMethod.Next);
+      ObjCMethodList *Mem = BumpAlloc.Allocate<ObjCMethodList>();
+      ObjCMethodList *OMI = new (Mem) ObjCMethodList(Method, FirstMethod.Next);
       FirstMethod.Next = OMI;
     }
   }