move the interace list of @class to use ObjCList.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65129 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index 5b59af9..b0d36db 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -115,22 +115,11 @@
ObjCClassDecl *ObjCClassDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation L,
- ObjCInterfaceDecl **Elts, unsigned nElts) {
+ ObjCInterfaceDecl *const *Elts,
+ unsigned nElts) {
return new (C) ObjCClassDecl(DC, L, Elts, nElts);
}
-ObjCClassDecl::ObjCClassDecl(DeclContext *DC, SourceLocation L,
- ObjCInterfaceDecl **Elts, unsigned nElts)
- : Decl(ObjCClass, DC, L) {
- if (nElts) {
- ForwardDecls = new ObjCInterfaceDecl*[nElts];
- memcpy(ForwardDecls, Elts, nElts*sizeof(ObjCInterfaceDecl*));
- } else {
- ForwardDecls = 0;
- }
- NumForwardDecls = nElts;
-}
-
void ObjCClassDecl::Destroy(ASTContext &C) {
// FIXME: There is no clear ownership policy now for referenced
@@ -141,9 +130,7 @@
// obviating this problem. Because of this situation, referenced
// ObjCInterfaceDecls are destroyed in ~TranslationUnit.
- delete [] ForwardDecls;
- ForwardDecls = 0;
-
+ ForwardDecls.clear();
Decl::Destroy(C);
}