diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2007-09-18 20:26:58 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2007-09-18 20:26:58 +0000 |
commit | fd225cc227143553898f2d3902242d25db9a4902 (patch) | |
tree | e012e139c6f745a8cda686eee6bca618d03478e4 /AST/Decl.cpp | |
parent | 8e2806573e74465c887a23b1bb4a05769a59b564 (diff) |
Patch for object creation and handling of category declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42104 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'AST/Decl.cpp')
-rw-r--r-- | AST/Decl.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/AST/Decl.cpp b/AST/Decl.cpp index 0cbadbf969..4b330eeeeb 100644 --- a/AST/Decl.cpp +++ b/AST/Decl.cpp @@ -29,6 +29,7 @@ static unsigned nInterfaceDecls = 0; static unsigned nClassDecls = 0; static unsigned nMethodDecls = 0; static unsigned nProtocolDecls = 0; +static unsigned nCategoryDecls = 0; static unsigned nIvarDecls = 0; static bool StatSwitch = false; @@ -79,7 +80,7 @@ void Decl::PrintStats() { fprintf(stderr, " %d decls total.\n", int(nFuncs+nBlockVars+nFileVars+nParmVars+nFieldDecls+nSUC+ nEnumDecls+nEnumConst+nTypedef+nInterfaceDecls+nClassDecls+ - nMethodDecls+nProtocolDecls+nIvarDecls)); + nMethodDecls+nProtocolDecls+nCategoryDecls+nIvarDecls)); fprintf(stderr, " %d function decls, %d each (%d bytes)\n", nFuncs, (int)sizeof(FunctionDecl), int(nFuncs*sizeof(FunctionDecl))); fprintf(stderr, " %d block variable decls, %d each (%d bytes)\n", @@ -121,6 +122,9 @@ void Decl::PrintStats() { fprintf(stderr, " %d protocol decls, %d each (%d bytes)\n", nProtocolDecls, (int)sizeof(ObjcProtocolDecl), int(nProtocolDecls*sizeof(ObjcProtocolDecl))); + fprintf(stderr, " %d category decls, %d each (%d bytes)\n", + nCategoryDecls, (int)sizeof(ObjcCategoryDecl), + int(nCategoryDecls*sizeof(ObjcCategoryDecl))); fprintf(stderr, "Total bytes = %d\n", int(nFuncs*sizeof(FunctionDecl)+nBlockVars*sizeof(BlockVarDecl)+ @@ -174,6 +178,9 @@ void Decl::addDeclKind(const Kind k) { case ObjcProtocol: nProtocolDecls++; break; + case ObjcCategory: + nCategoryDecls++; + break; case ObjcIvar: nIvarDecls++; break; @@ -308,4 +315,23 @@ void ObjcProtocolDecl::ObjcAddProtoMethods(ObjcMethodDecl **insMethods, } } +/// ObjcAddCat - Insert instance and methods declarations into +/// ObjcProtocolDecl's CatInsMethods and CatClsMethods fields. +/// +void ObjcCategoryDecl::ObjcAddCatMethods(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*)); + } +} + |