Allocate 'ObjCMethodList' objects (owned by Sema) using Sema's BumpPtrAllocator. Previously they were not getting freed. Fixes <rdar://problem/7635663>.

llvm-svn: 95834
This commit is contained in:
Ted Kremenek 2010-02-11 00:53:01 +00:00
parent 5c73e918c5
commit da4abf11bf
2 changed files with 10 additions and 4 deletions

View 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;
}

View 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;
}
}