This patch introduces the ObjcCategoryImplDecl class and does the checking related to
unimplemented methods in category implementation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42531 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/Decl.cpp b/AST/Decl.cpp
index ddf4187..d23f3cb 100644
--- a/AST/Decl.cpp
+++ b/AST/Decl.cpp
@@ -34,6 +34,7 @@
static unsigned nCategoryDecls = 0;
static unsigned nIvarDecls = 0;
static unsigned nObjcImplementationDecls = 0;
+static unsigned nObjcCategoryImpl = 0;
static bool StatSwitch = false;
@@ -136,6 +137,10 @@
nObjcImplementationDecls, (int)sizeof(ObjcImplementationDecl),
int(nObjcImplementationDecls*sizeof(ObjcImplementationDecl)));
+ fprintf(stderr, " %d class implementation decls, %d each (%d bytes)\n",
+ nObjcCategoryImpl, (int)sizeof(ObjcCategoryImplDecl),
+ int(nObjcCategoryImpl*sizeof(ObjcCategoryImplDecl)));
+
fprintf(stderr, "Total bytes = %d\n",
int(nFuncs*sizeof(FunctionDecl)+nBlockVars*sizeof(BlockVarDecl)+
nFileVars*sizeof(FileVarDecl)+nParmVars*sizeof(ParmVarDecl)+
@@ -199,6 +204,9 @@
case ObjcImplementation:
nObjcImplementationDecls++;
break;
+ case ObjcCategoryImpl:
+ nObjcCategoryImpl++;
+ break;
}
}
@@ -344,7 +352,7 @@
}
/// ObjcAddCat - Insert instance and methods declarations into
-/// ObjcProtocolDecl's CatInsMethods and CatClsMethods fields.
+/// ObjcCategoryDecl's CatInsMethods and CatClsMethods fields.
///
void ObjcCategoryDecl::ObjcAddCatMethods(ObjcMethodDecl **insMethods,
unsigned numInsMembers,
@@ -362,6 +370,25 @@
}
}
+/// ObjcAddCatImplMethods - Insert instance and methods declarations into
+/// ObjcCategoryImplDecl's CatInsMethods and CatClsMethods fields.
+///
+void ObjcCategoryImplDecl::ObjcAddCatImplMethods(ObjcMethodDecl **insMethods,
+ unsigned numInsMembers,
+ ObjcMethodDecl **clsMethods,
+ unsigned numClsMembers) {
+ NumCatInsMethods = numInsMembers;
+ if (numInsMembers) {
+ CatInsMethods = new ObjcMethodDecl*[numInsMembers];
+ memcpy(CatInsMethods, insMethods, numInsMembers*sizeof(ObjcMethodDecl*));
+ }
+ NumCatClsMethods = numClsMembers;
+ if (numClsMembers) {
+ CatClsMethods = new ObjcMethodDecl*[numClsMembers];
+ memcpy(CatClsMethods, clsMethods, numClsMembers*sizeof(ObjcMethodDecl*));
+ }
+}
+
/// ObjcAddImplMethods - Insert instance and methods declarations into
/// ObjcImplementationDecl's InsMethods and ClsMethods fields.
///