aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-02-11 00:53:01 +0000
committerTed Kremenek <kremenek@apple.com>2010-02-11 00:53:01 +0000
commit298ed870c7d8edf243edf14d624e577d4a3a8800 (patch)
tree757ebe0a9ce71caf3579532cb6b3fb04538d0d26
parent96a01b4acf76fb8fe1e05341a97a27b39fb0b914 (diff)
Allocate 'ObjCMethodList' objects (owned by Sema) using Sema's BumpPtrAllocator. Previously they were not getting freed. Fixes <rdar://problem/7635663>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95834 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Frontend/PCHReader.cpp8
-rw-r--r--lib/Sema/SemaDeclObjC.cpp6
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp
index 655d59fa8b..2a22132ea8 100644
--- a/lib/Frontend/PCHReader.cpp
+++ b/lib/Frontend/PCHReader.cpp
@@ -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;
}
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 13eeb6c761..af51fb10c1 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -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;
}
}