diff options
author | Steve Naroff <snaroff@apple.com> | 2007-09-17 14:16:13 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2007-09-17 14:16:13 +0000 |
commit | 3f128ad2691d299b96663da85a9e069c4081ea7c (patch) | |
tree | dd6d3313ba38b90d71adfcf7b1d135465b54aaa2 /AST/Decl.cpp | |
parent | 3860c11a3f8a862db25014d555745d8cfd3aaec9 (diff) |
Add support for ObjC keyword selectors.
- Add SelectorInfo/SelectorTable classes, modeled after IdentifierInfo/IdentifierTable.
- Add SelectorTable instance to ASTContext, created lazily through ASTContext::getSelectorInfo().
- Add SelectorInfo slot to ObjcMethodDecl.
- Add helper function to derive a SelectorInfo from ObjcKeywordInfo.
Misc: Got the Decl stats stuff up and running again...it was missing support for ObjC AST's.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42023 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'AST/Decl.cpp')
-rw-r--r-- | AST/Decl.cpp | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/AST/Decl.cpp b/AST/Decl.cpp index 285b184217..ee5b073918 100644 --- a/AST/Decl.cpp +++ b/AST/Decl.cpp @@ -26,6 +26,11 @@ static unsigned nEnumDecls = 0; static unsigned nTypedef = 0; static unsigned nFieldDecls = 0; static unsigned nInterfaceDecls = 0; +static unsigned nClassDecls = 0; +static unsigned nMethodDecls = 0; +static unsigned nProtocolDecls = 0; +static unsigned nIvarDecls = 0; + static bool StatSwitch = false; const char *Decl::getDeclKindName() { @@ -73,7 +78,8 @@ void Decl::PrintStats() { fprintf(stderr, "*** Decl Stats:\n"); fprintf(stderr, " %d decls total.\n", int(nFuncs+nBlockVars+nFileVars+nParmVars+nFieldDecls+nSUC+ - nEnumDecls+nEnumConst+nTypedef)); + nEnumDecls+nEnumConst+nTypedef+nInterfaceDecls+nClassDecls+ + nMethodDecls+nProtocolDecls+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", @@ -99,12 +105,29 @@ void Decl::PrintStats() { int(nEnumConst*sizeof(EnumConstantDecl))); fprintf(stderr, " %d typedef decls, %d each (%d bytes)\n", nTypedef, (int)sizeof(TypedefDecl),int(nTypedef*sizeof(TypedefDecl))); + // Objective-C decls... + fprintf(stderr, " %d interface decls, %d each (%d bytes)\n", + nInterfaceDecls, (int)sizeof(ObjcInterfaceDecl), + int(nInterfaceDecls*sizeof(ObjcInterfaceDecl))); + fprintf(stderr, " %d instance variable decls, %d each (%d bytes)\n", + nIvarDecls, (int)sizeof(ObjcIvarDecl), + int(nIvarDecls*sizeof(ObjcIvarDecl))); + fprintf(stderr, " %d class decls, %d each (%d bytes)\n", + nClassDecls, (int)sizeof(ObjcClassDecl), + int(nClassDecls*sizeof(ObjcClassDecl))); + fprintf(stderr, " %d method decls, %d each (%d bytes)\n", + nMethodDecls, (int)sizeof(ObjcMethodDecl), + int(nMethodDecls*sizeof(ObjcMethodDecl))); + fprintf(stderr, " %d protocol decls, %d each (%d bytes)\n", + nProtocolDecls, (int)sizeof(ObjcProtocolDecl), + int(nProtocolDecls*sizeof(ObjcProtocolDecl))); + fprintf(stderr, "Total bytes = %d\n", int(nFuncs*sizeof(FunctionDecl)+nBlockVars*sizeof(BlockVarDecl)+ nFileVars*sizeof(FileVarDecl)+nParmVars*sizeof(ParmVarDecl)+ nFieldDecls*sizeof(FieldDecl)+nSUC*sizeof(RecordDecl)+ nEnumDecls*sizeof(EnumDecl)+nEnumConst*sizeof(EnumConstantDecl)+ - nTypedef*sizeof(TypedefDecl))); + nTypedef*sizeof(TypedefDecl)) /* FIXME: add Objc decls */); } void Decl::addDeclKind(const Kind k) { @@ -142,11 +165,17 @@ void Decl::addDeclKind(const Kind k) { nInterfaceDecls++; break; case ObjcClass: + nClassDecls++; + break; case ObjcMethod: case ObjcProtoMethod: + nMethodDecls++; + break; case ObjcProtocol: + nProtocolDecls++; + break; case ObjcIvar: - assert(0 && "FIXME: Count these decls!"); + nIvarDecls++; break; } } |