public:
ObjCList() : List(0), NumElts(0) {}
~ObjCList() {
- delete[] List;
+ assert(List == 0 && "Destroy should have been called before dtor");
}
- void clear() {
+ void Destroy() {
delete[] List;
NumElts = 0;
+ List = 0;
}
void set(T* const* InList, unsigned Elts) {
for (param_iterator I=param_begin(), E=param_end(); I!=E; ++I)
if (*I) (*I)->Destroy(C);
- ParamInfo.clear();
+ ParamInfo.Destroy();
Decl::Destroy(C);
}
for (ivar_iterator I=ivar_begin(), E=ivar_end(); I!=E; ++I)
if (*I) (*I)->Destroy(C);
- IVars.clear();
+ IVars.Destroy();
// FIXME: CategoryList?
// FIXME: Because there is no clear ownership
}
void ObjCProtocolDecl::Destroy(ASTContext &C) {
- ReferencedProtocols.clear();
+ ReferencedProtocols.Destroy();
ObjCContainerDecl::Destroy(C);
}
// obviating this problem. Because of this situation, referenced
// ObjCInterfaceDecls are destroyed in ~TranslationUnit.
- ForwardDecls.clear();
+ ForwardDecls.Destroy();
Decl::Destroy(C);
}
}
void ObjCForwardProtocolDecl::Destroy(ASTContext &C) {
- ReferencedProtocols.clear();
+ ReferencedProtocols.Destroy();
Decl::Destroy(C);
}
/// Destroy - Call destructors and release memory.
void ObjCImplementationDecl::Destroy(ASTContext& C) {
- IVars.clear();
+ IVars.Destroy();
Decl::Destroy(C);
}