2007-07-11 21:01:13 +04:00
|
|
|
//===--- Decl.cpp - Declaration AST Node Implementation -------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 22:59:25 +03:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2007-07-11 21:01:13 +04:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file implements the Decl class and subclasses.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "clang/AST/Decl.h"
|
2007-10-01 23:00:59 +04:00
|
|
|
#include "clang/AST/DeclObjC.h"
|
2008-02-15 10:04:12 +03:00
|
|
|
#include "clang/AST/Attr.h"
|
2007-10-07 12:58:51 +04:00
|
|
|
#include "clang/Basic/IdentifierTable.h"
|
2008-02-16 02:30:50 +03:00
|
|
|
#include "llvm/ADT/DenseMap.h"
|
|
|
|
|
2007-07-11 21:01:13 +04:00
|
|
|
using namespace clang;
|
|
|
|
|
|
|
|
// temporary statistics gathering
|
|
|
|
static unsigned nFuncs = 0;
|
|
|
|
static unsigned nBlockVars = 0;
|
|
|
|
static unsigned nFileVars = 0;
|
|
|
|
static unsigned nParmVars = 0;
|
|
|
|
static unsigned nSUC = 0;
|
|
|
|
static unsigned nEnumConst = 0;
|
|
|
|
static unsigned nEnumDecls = 0;
|
|
|
|
static unsigned nTypedef = 0;
|
|
|
|
static unsigned nFieldDecls = 0;
|
2007-09-07 01:24:23 +04:00
|
|
|
static unsigned nInterfaceDecls = 0;
|
2007-09-17 18:16:13 +04:00
|
|
|
static unsigned nClassDecls = 0;
|
|
|
|
static unsigned nMethodDecls = 0;
|
|
|
|
static unsigned nProtocolDecls = 0;
|
2007-09-21 19:40:54 +04:00
|
|
|
static unsigned nForwardProtocolDecls = 0;
|
2007-09-19 00:26:58 +04:00
|
|
|
static unsigned nCategoryDecls = 0;
|
2007-09-17 18:16:13 +04:00
|
|
|
static unsigned nIvarDecls = 0;
|
2008-01-07 22:49:32 +03:00
|
|
|
static unsigned nObjCImplementationDecls = 0;
|
|
|
|
static unsigned nObjCCategoryImpl = 0;
|
|
|
|
static unsigned nObjCCompatibleAlias = 0;
|
|
|
|
static unsigned nObjCPropertyDecl = 0;
|
2008-01-12 10:05:38 +03:00
|
|
|
static unsigned nLinkageSpecDecl = 0;
|
2008-02-08 03:33:21 +03:00
|
|
|
static unsigned nFileScopeAsmDecl = 0;
|
2007-09-17 18:16:13 +04:00
|
|
|
|
2007-07-11 21:01:13 +04:00
|
|
|
static bool StatSwitch = false;
|
|
|
|
|
2008-02-16 02:30:50 +03:00
|
|
|
// This keeps track of all decl attributes. Since so few decls have attrs, we
|
|
|
|
// keep them in a hash map instead of wasting space in the Decl class.
|
|
|
|
typedef llvm::DenseMap<const Decl*, Attr*> DeclAttrMapTy;
|
|
|
|
|
|
|
|
static DeclAttrMapTy *DeclAttrs = 0;
|
|
|
|
|
2007-09-17 18:49:06 +04:00
|
|
|
const char *Decl::getDeclKindName() const {
|
2007-09-16 20:16:00 +04:00
|
|
|
switch (DeclKind) {
|
|
|
|
default: assert(0 && "Unknown decl kind!");
|
|
|
|
case Typedef:
|
|
|
|
return "Typedef";
|
|
|
|
case Function:
|
|
|
|
return "Function";
|
2007-10-09 01:37:32 +04:00
|
|
|
case BlockVar:
|
|
|
|
return "BlockVar";
|
|
|
|
case FileVar:
|
|
|
|
return "FileVar";
|
|
|
|
case ParmVar:
|
|
|
|
return "ParmVar";
|
2007-09-16 20:16:00 +04:00
|
|
|
case EnumConstant:
|
|
|
|
return "EnumConstant";
|
2008-01-07 22:49:32 +03:00
|
|
|
case ObjCInterface:
|
|
|
|
return "ObjCInterface";
|
|
|
|
case ObjCClass:
|
|
|
|
return "ObjCClass";
|
|
|
|
case ObjCMethod:
|
|
|
|
return "ObjCMethod";
|
|
|
|
case ObjCProtocol:
|
|
|
|
return "ObjCProtocol";
|
|
|
|
case ObjCForwardProtocol:
|
|
|
|
return "ObjCForwardProtocol";
|
2007-09-16 20:16:00 +04:00
|
|
|
case Struct:
|
|
|
|
return "Struct";
|
|
|
|
case Union:
|
|
|
|
return "Union";
|
|
|
|
case Class:
|
|
|
|
return "Class";
|
|
|
|
case Enum:
|
|
|
|
return "Enum";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-07-11 21:01:13 +04:00
|
|
|
bool Decl::CollectingStats(bool enable) {
|
|
|
|
if (enable) StatSwitch = true;
|
2007-10-04 04:45:27 +04:00
|
|
|
return StatSwitch;
|
2007-07-11 21:01:13 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void Decl::PrintStats() {
|
|
|
|
fprintf(stderr, "*** Decl Stats:\n");
|
|
|
|
fprintf(stderr, " %d decls total.\n",
|
2008-02-26 00:04:36 +03:00
|
|
|
int(nFuncs+nBlockVars+nFileVars+nParmVars+nFieldDecls+nSUC+
|
|
|
|
nEnumDecls+nEnumConst+nTypedef+nInterfaceDecls+nClassDecls+
|
|
|
|
nMethodDecls+nProtocolDecls+nCategoryDecls+nIvarDecls));
|
2007-07-11 21:01:13 +04:00
|
|
|
fprintf(stderr, " %d function decls, %d each (%d bytes)\n",
|
2008-02-26 00:04:36 +03:00
|
|
|
nFuncs, (int)sizeof(FunctionDecl), int(nFuncs*sizeof(FunctionDecl)));
|
2007-07-11 21:01:13 +04:00
|
|
|
fprintf(stderr, " %d block variable decls, %d each (%d bytes)\n",
|
2008-02-26 00:04:36 +03:00
|
|
|
nBlockVars, (int)sizeof(BlockVarDecl),
|
|
|
|
int(nBlockVars*sizeof(BlockVarDecl)));
|
2007-07-11 21:01:13 +04:00
|
|
|
fprintf(stderr, " %d file variable decls, %d each (%d bytes)\n",
|
2008-02-26 00:04:36 +03:00
|
|
|
nFileVars, (int)sizeof(FileVarDecl),
|
|
|
|
int(nFileVars*sizeof(FileVarDecl)));
|
2007-07-11 21:01:13 +04:00
|
|
|
fprintf(stderr, " %d parameter variable decls, %d each (%d bytes)\n",
|
2008-02-26 00:04:36 +03:00
|
|
|
nParmVars, (int)sizeof(ParmVarDecl),
|
|
|
|
int(nParmVars*sizeof(ParmVarDecl)));
|
2007-07-11 21:01:13 +04:00
|
|
|
fprintf(stderr, " %d field decls, %d each (%d bytes)\n",
|
2008-02-26 00:04:36 +03:00
|
|
|
nFieldDecls, (int)sizeof(FieldDecl),
|
|
|
|
int(nFieldDecls*sizeof(FieldDecl)));
|
2007-07-11 21:01:13 +04:00
|
|
|
fprintf(stderr, " %d struct/union/class decls, %d each (%d bytes)\n",
|
2008-02-26 00:04:36 +03:00
|
|
|
nSUC, (int)sizeof(RecordDecl),
|
|
|
|
int(nSUC*sizeof(RecordDecl)));
|
2007-07-11 21:01:13 +04:00
|
|
|
fprintf(stderr, " %d enum decls, %d each (%d bytes)\n",
|
2008-02-26 00:04:36 +03:00
|
|
|
nEnumDecls, (int)sizeof(EnumDecl),
|
|
|
|
int(nEnumDecls*sizeof(EnumDecl)));
|
2007-07-11 21:01:13 +04:00
|
|
|
fprintf(stderr, " %d enum constant decls, %d each (%d bytes)\n",
|
2008-02-26 00:04:36 +03:00
|
|
|
nEnumConst, (int)sizeof(EnumConstantDecl),
|
|
|
|
int(nEnumConst*sizeof(EnumConstantDecl)));
|
2007-07-11 21:01:13 +04:00
|
|
|
fprintf(stderr, " %d typedef decls, %d each (%d bytes)\n",
|
2008-02-26 00:04:36 +03:00
|
|
|
nTypedef, (int)sizeof(TypedefDecl),int(nTypedef*sizeof(TypedefDecl)));
|
2007-09-17 18:16:13 +04:00
|
|
|
// Objective-C decls...
|
|
|
|
fprintf(stderr, " %d interface decls, %d each (%d bytes)\n",
|
2008-02-26 00:04:36 +03:00
|
|
|
nInterfaceDecls, (int)sizeof(ObjCInterfaceDecl),
|
|
|
|
int(nInterfaceDecls*sizeof(ObjCInterfaceDecl)));
|
2007-09-17 18:16:13 +04:00
|
|
|
fprintf(stderr, " %d instance variable decls, %d each (%d bytes)\n",
|
2008-02-26 00:04:36 +03:00
|
|
|
nIvarDecls, (int)sizeof(ObjCIvarDecl),
|
|
|
|
int(nIvarDecls*sizeof(ObjCIvarDecl)));
|
2007-09-17 18:16:13 +04:00
|
|
|
fprintf(stderr, " %d class decls, %d each (%d bytes)\n",
|
2008-02-26 00:04:36 +03:00
|
|
|
nClassDecls, (int)sizeof(ObjCClassDecl),
|
|
|
|
int(nClassDecls*sizeof(ObjCClassDecl)));
|
2007-09-17 18:16:13 +04:00
|
|
|
fprintf(stderr, " %d method decls, %d each (%d bytes)\n",
|
2008-02-26 00:04:36 +03:00
|
|
|
nMethodDecls, (int)sizeof(ObjCMethodDecl),
|
|
|
|
int(nMethodDecls*sizeof(ObjCMethodDecl)));
|
2007-09-17 18:16:13 +04:00
|
|
|
fprintf(stderr, " %d protocol decls, %d each (%d bytes)\n",
|
2008-02-26 00:04:36 +03:00
|
|
|
nProtocolDecls, (int)sizeof(ObjCProtocolDecl),
|
|
|
|
int(nProtocolDecls*sizeof(ObjCProtocolDecl)));
|
2007-09-21 19:40:54 +04:00
|
|
|
fprintf(stderr, " %d forward protocol decls, %d each (%d bytes)\n",
|
2008-02-26 00:04:36 +03:00
|
|
|
nForwardProtocolDecls, (int)sizeof(ObjCForwardProtocolDecl),
|
|
|
|
int(nForwardProtocolDecls*sizeof(ObjCForwardProtocolDecl)));
|
2007-09-19 00:26:58 +04:00
|
|
|
fprintf(stderr, " %d category decls, %d each (%d bytes)\n",
|
2008-02-26 00:04:36 +03:00
|
|
|
nCategoryDecls, (int)sizeof(ObjCCategoryDecl),
|
|
|
|
int(nCategoryDecls*sizeof(ObjCCategoryDecl)));
|
2007-09-17 18:16:13 +04:00
|
|
|
|
2007-09-25 22:38:09 +04:00
|
|
|
fprintf(stderr, " %d class implementation decls, %d each (%d bytes)\n",
|
2008-02-26 00:04:36 +03:00
|
|
|
nObjCImplementationDecls, (int)sizeof(ObjCImplementationDecl),
|
|
|
|
int(nObjCImplementationDecls*sizeof(ObjCImplementationDecl)));
|
2007-09-25 22:38:09 +04:00
|
|
|
|
2007-10-02 20:38:50 +04:00
|
|
|
fprintf(stderr, " %d class implementation decls, %d each (%d bytes)\n",
|
2008-02-26 00:04:36 +03:00
|
|
|
nObjCCategoryImpl, (int)sizeof(ObjCCategoryImplDecl),
|
|
|
|
int(nObjCCategoryImpl*sizeof(ObjCCategoryImplDecl)));
|
2007-10-02 20:38:50 +04:00
|
|
|
|
2007-10-12 03:42:27 +04:00
|
|
|
fprintf(stderr, " %d compatibility alias decls, %d each (%d bytes)\n",
|
2008-02-26 00:04:36 +03:00
|
|
|
nObjCCompatibleAlias, (int)sizeof(ObjCCompatibleAliasDecl),
|
|
|
|
int(nObjCCompatibleAlias*sizeof(ObjCCompatibleAliasDecl)));
|
2007-10-12 03:42:27 +04:00
|
|
|
|
2007-11-07 01:01:00 +03:00
|
|
|
fprintf(stderr, " %d property decls, %d each (%d bytes)\n",
|
2008-02-26 00:04:36 +03:00
|
|
|
nObjCPropertyDecl, (int)sizeof(ObjCPropertyDecl),
|
|
|
|
int(nObjCPropertyDecl*sizeof(ObjCPropertyDecl)));
|
2007-11-07 01:01:00 +03:00
|
|
|
|
2007-07-11 21:01:13 +04:00
|
|
|
fprintf(stderr, "Total bytes = %d\n",
|
2008-02-26 00:04:36 +03:00
|
|
|
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)+
|
2008-01-23 04:34:33 +03:00
|
|
|
nInterfaceDecls*sizeof(ObjCInterfaceDecl)+
|
|
|
|
nIvarDecls*sizeof(ObjCIvarDecl)+
|
|
|
|
nClassDecls*sizeof(ObjCClassDecl)+
|
|
|
|
nMethodDecls*sizeof(ObjCMethodDecl)+
|
|
|
|
nProtocolDecls*sizeof(ObjCProtocolDecl)+
|
|
|
|
nForwardProtocolDecls*sizeof(ObjCForwardProtocolDecl)+
|
|
|
|
nCategoryDecls*sizeof(ObjCCategoryDecl)+
|
|
|
|
nObjCImplementationDecls*sizeof(ObjCImplementationDecl)+
|
|
|
|
nObjCCategoryImpl*sizeof(ObjCCategoryImplDecl)+
|
|
|
|
nObjCCompatibleAlias*sizeof(ObjCCompatibleAliasDecl)+
|
|
|
|
nObjCPropertyDecl*sizeof(ObjCPropertyDecl)+
|
2008-02-08 03:33:21 +03:00
|
|
|
nLinkageSpecDecl*sizeof(LinkageSpecDecl)+
|
|
|
|
nFileScopeAsmDecl*sizeof(FileScopeAsmDecl)));
|
2008-01-23 04:34:33 +03:00
|
|
|
|
2007-07-11 21:01:13 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void Decl::addDeclKind(const Kind k) {
|
|
|
|
switch (k) {
|
|
|
|
case Typedef:
|
|
|
|
nTypedef++;
|
|
|
|
break;
|
|
|
|
case Function:
|
|
|
|
nFuncs++;
|
|
|
|
break;
|
2007-10-09 01:37:32 +04:00
|
|
|
case BlockVar:
|
2007-07-11 21:01:13 +04:00
|
|
|
nBlockVars++;
|
|
|
|
break;
|
2007-10-09 01:37:32 +04:00
|
|
|
case FileVar:
|
2007-07-11 21:01:13 +04:00
|
|
|
nFileVars++;
|
|
|
|
break;
|
2007-10-09 01:37:32 +04:00
|
|
|
case ParmVar:
|
2007-07-11 21:01:13 +04:00
|
|
|
nParmVars++;
|
|
|
|
break;
|
|
|
|
case EnumConstant:
|
|
|
|
nEnumConst++;
|
|
|
|
break;
|
|
|
|
case Field:
|
|
|
|
nFieldDecls++;
|
|
|
|
break;
|
|
|
|
case Struct:
|
|
|
|
case Union:
|
|
|
|
case Class:
|
|
|
|
nSUC++;
|
|
|
|
break;
|
|
|
|
case Enum:
|
|
|
|
nEnumDecls++;
|
|
|
|
break;
|
2008-01-07 22:49:32 +03:00
|
|
|
case ObjCInterface:
|
2007-09-07 01:24:23 +04:00
|
|
|
nInterfaceDecls++;
|
|
|
|
break;
|
2008-01-07 22:49:32 +03:00
|
|
|
case ObjCClass:
|
2007-09-17 18:16:13 +04:00
|
|
|
nClassDecls++;
|
|
|
|
break;
|
2008-01-07 22:49:32 +03:00
|
|
|
case ObjCMethod:
|
2007-09-17 18:16:13 +04:00
|
|
|
nMethodDecls++;
|
|
|
|
break;
|
2008-01-07 22:49:32 +03:00
|
|
|
case ObjCProtocol:
|
2007-09-17 18:16:13 +04:00
|
|
|
nProtocolDecls++;
|
|
|
|
break;
|
2008-01-07 22:49:32 +03:00
|
|
|
case ObjCForwardProtocol:
|
2007-09-21 19:40:54 +04:00
|
|
|
nForwardProtocolDecls++;
|
|
|
|
break;
|
2008-01-07 22:49:32 +03:00
|
|
|
case ObjCCategory:
|
2007-09-19 00:26:58 +04:00
|
|
|
nCategoryDecls++;
|
|
|
|
break;
|
2008-01-07 22:49:32 +03:00
|
|
|
case ObjCIvar:
|
2007-09-17 18:16:13 +04:00
|
|
|
nIvarDecls++;
|
2007-09-16 23:23:04 +04:00
|
|
|
break;
|
2008-01-07 22:49:32 +03:00
|
|
|
case ObjCImplementation:
|
|
|
|
nObjCImplementationDecls++;
|
2007-09-25 22:38:09 +04:00
|
|
|
break;
|
2008-01-07 22:49:32 +03:00
|
|
|
case ObjCCategoryImpl:
|
|
|
|
nObjCCategoryImpl++;
|
2007-10-02 20:38:50 +04:00
|
|
|
break;
|
2007-10-12 03:42:27 +04:00
|
|
|
case CompatibleAlias:
|
2008-01-07 22:49:32 +03:00
|
|
|
nObjCCompatibleAlias++;
|
2007-10-12 03:42:27 +04:00
|
|
|
break;
|
2007-11-07 01:01:00 +03:00
|
|
|
case PropertyDecl:
|
2008-01-07 22:49:32 +03:00
|
|
|
nObjCPropertyDecl++;
|
2007-11-07 01:01:00 +03:00
|
|
|
break;
|
2008-01-12 10:05:38 +03:00
|
|
|
case LinkageSpec:
|
|
|
|
nLinkageSpecDecl++;
|
|
|
|
break;
|
2008-02-08 03:33:21 +03:00
|
|
|
case FileScopeAsm:
|
|
|
|
nFileScopeAsmDecl++;
|
|
|
|
break;
|
2007-07-11 21:01:13 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Out-of-line virtual method providing a home for Decl.
|
|
|
|
Decl::~Decl() {
|
2008-02-16 06:37:41 +03:00
|
|
|
if (!HasAttrs)
|
2008-02-16 02:30:50 +03:00
|
|
|
return;
|
|
|
|
|
|
|
|
DeclAttrMapTy::iterator it = DeclAttrs->find(this);
|
2008-02-16 06:37:41 +03:00
|
|
|
assert(it != DeclAttrs->end() && "No attrs found but HasAttrs is true!");
|
|
|
|
|
|
|
|
delete it->second;
|
|
|
|
DeclAttrs->erase(it);
|
|
|
|
if (DeclAttrs->empty()) {
|
|
|
|
delete DeclAttrs;
|
|
|
|
DeclAttrs = 0;
|
|
|
|
}
|
2008-02-16 02:30:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void Decl::addAttr(Attr *newattr)
|
|
|
|
{
|
|
|
|
if (!DeclAttrs)
|
|
|
|
DeclAttrs = new llvm::DenseMap<const Decl*, Attr*>;
|
|
|
|
|
2008-02-16 06:37:41 +03:00
|
|
|
Attr *&attr = (*DeclAttrs)[this];
|
2008-02-16 02:30:50 +03:00
|
|
|
|
|
|
|
newattr->setNext(attr);
|
|
|
|
attr = newattr;
|
|
|
|
|
|
|
|
HasAttrs = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
const Attr *Decl::getAttrs() const
|
|
|
|
{
|
2008-02-16 06:37:41 +03:00
|
|
|
if (!HasAttrs)
|
2008-02-16 02:30:50 +03:00
|
|
|
return 0;
|
|
|
|
|
2008-02-16 06:37:41 +03:00
|
|
|
return (*DeclAttrs)[this];
|
2007-07-11 21:01:13 +04:00
|
|
|
}
|
|
|
|
|
2007-10-07 02:53:46 +04:00
|
|
|
const char *NamedDecl::getName() const {
|
2007-07-11 21:01:13 +04:00
|
|
|
if (const IdentifierInfo *II = getIdentifier())
|
|
|
|
return II->getName();
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
FunctionDecl::~FunctionDecl() {
|
|
|
|
delete[] ParamInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned FunctionDecl::getNumParams() const {
|
2007-12-06 20:20:20 +03:00
|
|
|
if (isa<FunctionTypeNoProto>(getCanonicalType())) return 0;
|
|
|
|
return cast<FunctionTypeProto>(getCanonicalType())->getNumArgs();
|
2007-07-11 21:01:13 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void FunctionDecl::setParams(ParmVarDecl **NewParamInfo, unsigned NumParams) {
|
|
|
|
assert(ParamInfo == 0 && "Already has param info!");
|
|
|
|
assert(NumParams == getNumParams() && "Parameter count mismatch!");
|
|
|
|
|
|
|
|
// Zero params -> null pointer.
|
|
|
|
if (NumParams) {
|
|
|
|
ParamInfo = new ParmVarDecl*[NumParams];
|
|
|
|
memcpy(ParamInfo, NewParamInfo, sizeof(ParmVarDecl*)*NumParams);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// defineBody - When created, RecordDecl's correspond to a forward declared
|
|
|
|
/// record. This method is used to mark the decl as being defined, with the
|
|
|
|
/// specified contents.
|
|
|
|
void RecordDecl::defineBody(FieldDecl **members, unsigned numMembers) {
|
|
|
|
assert(!isDefinition() && "Cannot redefine record!");
|
|
|
|
setDefinition(true);
|
|
|
|
NumMembers = numMembers;
|
|
|
|
if (numMembers) {
|
|
|
|
Members = new FieldDecl*[numMembers];
|
|
|
|
memcpy(Members, members, numMembers*sizeof(Decl*));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
FieldDecl* RecordDecl::getMember(IdentifierInfo *name) {
|
|
|
|
if (Members == 0 || NumMembers < 0)
|
|
|
|
return 0;
|
2007-10-04 04:45:27 +04:00
|
|
|
|
2007-07-11 21:01:13 +04:00
|
|
|
// linear search. When C++ classes come along, will likely need to revisit.
|
|
|
|
for (int i = 0; i < NumMembers; ++i) {
|
|
|
|
if (Members[i]->getIdentifier() == name)
|
|
|
|
return Members[i];
|
|
|
|
}
|
|
|
|
return 0;
|
2007-07-12 19:43:07 +04:00
|
|
|
}
|
2007-09-11 00:33:04 +04:00
|
|
|
|
2008-01-07 22:49:32 +03:00
|
|
|
void ObjCMethodDecl::setMethodParams(ParmVarDecl **NewParamInfo,
|
2007-10-04 21:06:28 +04:00
|
|
|
unsigned NumParams) {
|
2007-09-12 22:23:47 +04:00
|
|
|
assert(ParamInfo == 0 && "Already has param info!");
|
|
|
|
|
|
|
|
// Zero params -> null pointer.
|
|
|
|
if (NumParams) {
|
|
|
|
ParamInfo = new ParmVarDecl*[NumParams];
|
|
|
|
memcpy(ParamInfo, NewParamInfo, sizeof(ParmVarDecl*)*NumParams);
|
|
|
|
NumMethodParams = NumParams;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-07 22:49:32 +03:00
|
|
|
ObjCMethodDecl::~ObjCMethodDecl() {
|
2007-09-12 22:23:47 +04:00
|
|
|
delete[] ParamInfo;
|
|
|
|
}
|
|
|
|
|
2008-01-07 22:49:32 +03:00
|
|
|
/// ObjCAddInstanceVariablesToClass - Inserts instance variables
|
|
|
|
/// into ObjCInterfaceDecl's fields.
|
2007-09-15 01:08:27 +04:00
|
|
|
///
|
2008-01-07 22:49:32 +03:00
|
|
|
void ObjCInterfaceDecl::addInstanceVariablesToClass(ObjCIvarDecl **ivars,
|
2007-10-30 00:38:07 +03:00
|
|
|
unsigned numIvars,
|
2007-10-30 05:23:23 +03:00
|
|
|
SourceLocation RBrac) {
|
2007-09-15 01:08:27 +04:00
|
|
|
NumIvars = numIvars;
|
|
|
|
if (numIvars) {
|
2008-01-07 22:49:32 +03:00
|
|
|
Ivars = new ObjCIvarDecl*[numIvars];
|
|
|
|
memcpy(Ivars, ivars, numIvars*sizeof(ObjCIvarDecl*));
|
2007-09-15 01:08:27 +04:00
|
|
|
}
|
2007-10-30 05:23:23 +03:00
|
|
|
setLocEnd(RBrac);
|
2007-09-15 01:08:27 +04:00
|
|
|
}
|
|
|
|
|
2008-01-07 22:49:32 +03:00
|
|
|
/// ObjCAddInstanceVariablesToClassImpl - Checks for correctness of Instance
|
2007-09-26 22:27:25 +04:00
|
|
|
/// Variables (Ivars) relative to what declared in @implementation;s class.
|
2008-01-07 22:49:32 +03:00
|
|
|
/// Ivars into ObjCImplementationDecl's fields.
|
2007-09-26 22:27:25 +04:00
|
|
|
///
|
2008-01-07 22:49:32 +03:00
|
|
|
void ObjCImplementationDecl::ObjCAddInstanceVariablesToClassImpl(
|
|
|
|
ObjCIvarDecl **ivars, unsigned numIvars) {
|
2007-09-26 22:27:25 +04:00
|
|
|
NumIvars = numIvars;
|
|
|
|
if (numIvars) {
|
2008-01-07 22:49:32 +03:00
|
|
|
Ivars = new ObjCIvarDecl*[numIvars];
|
|
|
|
memcpy(Ivars, ivars, numIvars*sizeof(ObjCIvarDecl*));
|
2007-09-26 22:27:25 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-30 00:38:07 +03:00
|
|
|
/// addMethods - Insert instance and methods declarations into
|
2008-01-07 22:49:32 +03:00
|
|
|
/// ObjCInterfaceDecl's InsMethods and ClsMethods fields.
|
2007-09-11 00:33:04 +04:00
|
|
|
///
|
2008-01-07 22:49:32 +03:00
|
|
|
void ObjCInterfaceDecl::addMethods(ObjCMethodDecl **insMethods,
|
2007-10-30 00:38:07 +03:00
|
|
|
unsigned numInsMembers,
|
2008-01-07 22:49:32 +03:00
|
|
|
ObjCMethodDecl **clsMethods,
|
2007-10-30 00:38:07 +03:00
|
|
|
unsigned numClsMembers,
|
|
|
|
SourceLocation endLoc) {
|
2007-10-03 02:05:16 +04:00
|
|
|
NumInstanceMethods = numInsMembers;
|
2007-09-11 00:33:04 +04:00
|
|
|
if (numInsMembers) {
|
2008-01-07 22:49:32 +03:00
|
|
|
InstanceMethods = new ObjCMethodDecl*[numInsMembers];
|
|
|
|
memcpy(InstanceMethods, insMethods, numInsMembers*sizeof(ObjCMethodDecl*));
|
2007-09-11 00:33:04 +04:00
|
|
|
}
|
2007-10-03 02:05:16 +04:00
|
|
|
NumClassMethods = numClsMembers;
|
2007-09-11 00:33:04 +04:00
|
|
|
if (numClsMembers) {
|
2008-01-07 22:49:32 +03:00
|
|
|
ClassMethods = new ObjCMethodDecl*[numClsMembers];
|
|
|
|
memcpy(ClassMethods, clsMethods, numClsMembers*sizeof(ObjCMethodDecl*));
|
2007-09-11 00:33:04 +04:00
|
|
|
}
|
2007-10-30 05:23:23 +03:00
|
|
|
AtEndLoc = endLoc;
|
2007-09-11 00:33:04 +04:00
|
|
|
}
|
|
|
|
|
2007-10-30 00:38:07 +03:00
|
|
|
/// addMethods - Insert instance and methods declarations into
|
2008-01-07 22:49:32 +03:00
|
|
|
/// ObjCProtocolDecl's ProtoInsMethods and ProtoClsMethods fields.
|
2007-09-18 01:07:36 +04:00
|
|
|
///
|
2008-01-07 22:49:32 +03:00
|
|
|
void ObjCProtocolDecl::addMethods(ObjCMethodDecl **insMethods,
|
2007-10-30 00:38:07 +03:00
|
|
|
unsigned numInsMembers,
|
2008-01-07 22:49:32 +03:00
|
|
|
ObjCMethodDecl **clsMethods,
|
2007-10-30 00:38:07 +03:00
|
|
|
unsigned numClsMembers,
|
2007-10-30 16:30:57 +03:00
|
|
|
SourceLocation endLoc) {
|
2007-10-03 02:05:16 +04:00
|
|
|
NumInstanceMethods = numInsMembers;
|
2007-09-18 01:07:36 +04:00
|
|
|
if (numInsMembers) {
|
2008-01-07 22:49:32 +03:00
|
|
|
InstanceMethods = new ObjCMethodDecl*[numInsMembers];
|
|
|
|
memcpy(InstanceMethods, insMethods, numInsMembers*sizeof(ObjCMethodDecl*));
|
2007-09-18 01:07:36 +04:00
|
|
|
}
|
2007-10-03 02:05:16 +04:00
|
|
|
NumClassMethods = numClsMembers;
|
2007-09-18 01:07:36 +04:00
|
|
|
if (numClsMembers) {
|
2008-01-07 22:49:32 +03:00
|
|
|
ClassMethods = new ObjCMethodDecl*[numClsMembers];
|
|
|
|
memcpy(ClassMethods, clsMethods, numClsMembers*sizeof(ObjCMethodDecl*));
|
2007-09-18 01:07:36 +04:00
|
|
|
}
|
2007-10-30 16:30:57 +03:00
|
|
|
AtEndLoc = endLoc;
|
2007-09-18 01:07:36 +04:00
|
|
|
}
|
|
|
|
|
2007-10-30 00:38:07 +03:00
|
|
|
/// addMethods - Insert instance and methods declarations into
|
2008-01-07 22:49:32 +03:00
|
|
|
/// ObjCCategoryDecl's CatInsMethods and CatClsMethods fields.
|
2007-09-19 00:26:58 +04:00
|
|
|
///
|
2008-01-07 22:49:32 +03:00
|
|
|
void ObjCCategoryDecl::addMethods(ObjCMethodDecl **insMethods,
|
2007-10-30 00:38:07 +03:00
|
|
|
unsigned numInsMembers,
|
2008-01-07 22:49:32 +03:00
|
|
|
ObjCMethodDecl **clsMethods,
|
2007-10-30 00:38:07 +03:00
|
|
|
unsigned numClsMembers,
|
2007-10-30 16:30:57 +03:00
|
|
|
SourceLocation endLoc) {
|
2007-10-03 02:05:16 +04:00
|
|
|
NumInstanceMethods = numInsMembers;
|
2007-09-19 00:26:58 +04:00
|
|
|
if (numInsMembers) {
|
2008-01-07 22:49:32 +03:00
|
|
|
InstanceMethods = new ObjCMethodDecl*[numInsMembers];
|
|
|
|
memcpy(InstanceMethods, insMethods, numInsMembers*sizeof(ObjCMethodDecl*));
|
2007-10-02 20:38:50 +04:00
|
|
|
}
|
2007-10-03 02:05:16 +04:00
|
|
|
NumClassMethods = numClsMembers;
|
2007-10-02 20:38:50 +04:00
|
|
|
if (numClsMembers) {
|
2008-01-07 22:49:32 +03:00
|
|
|
ClassMethods = new ObjCMethodDecl*[numClsMembers];
|
|
|
|
memcpy(ClassMethods, clsMethods, numClsMembers*sizeof(ObjCMethodDecl*));
|
2007-10-02 20:38:50 +04:00
|
|
|
}
|
2007-10-30 16:30:57 +03:00
|
|
|
AtEndLoc = endLoc;
|
2007-10-02 20:38:50 +04:00
|
|
|
}
|
|
|
|
|
2008-01-07 22:49:32 +03:00
|
|
|
ObjCIvarDecl *ObjCInterfaceDecl::lookupInstanceVariable(
|
|
|
|
IdentifierInfo *ID, ObjCInterfaceDecl *&clsDeclared) {
|
|
|
|
ObjCInterfaceDecl* ClassDecl = this;
|
2007-11-12 16:56:41 +03:00
|
|
|
while (ClassDecl != NULL) {
|
2007-12-12 10:56:42 +03:00
|
|
|
for (ivar_iterator I = ClassDecl->ivar_begin(), E = ClassDecl->ivar_end();
|
|
|
|
I != E; ++I) {
|
|
|
|
if ((*I)->getIdentifier() == ID) {
|
2007-11-12 16:56:41 +03:00
|
|
|
clsDeclared = ClassDecl;
|
2007-12-12 10:56:42 +03:00
|
|
|
return *I;
|
2007-11-12 16:56:41 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
ClassDecl = ClassDecl->getSuperClass();
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2007-12-12 10:30:05 +03:00
|
|
|
/// lookupInstanceMethod - This method returns an instance method by looking in
|
2007-12-12 11:17:45 +03:00
|
|
|
/// the class, its categories, and its super classes (using a linear search).
|
2008-01-07 22:49:32 +03:00
|
|
|
ObjCMethodDecl *ObjCInterfaceDecl::lookupInstanceMethod(Selector Sel) {
|
|
|
|
ObjCInterfaceDecl* ClassDecl = this;
|
|
|
|
ObjCMethodDecl *MethodDecl = 0;
|
2007-12-15 02:37:57 +03:00
|
|
|
|
2007-10-03 00:01:56 +04:00
|
|
|
while (ClassDecl != NULL) {
|
2007-12-20 01:27:04 +03:00
|
|
|
if ((MethodDecl = ClassDecl->getInstanceMethod(Sel)))
|
2007-12-15 02:37:57 +03:00
|
|
|
return MethodDecl;
|
|
|
|
|
2007-10-15 03:13:51 +04:00
|
|
|
// Didn't find one yet - look through protocols.
|
2008-01-07 22:49:32 +03:00
|
|
|
ObjCProtocolDecl **protocols = ClassDecl->getReferencedProtocols();
|
2007-10-15 03:13:51 +04:00
|
|
|
int numProtocols = ClassDecl->getNumIntfRefProtocols();
|
|
|
|
for (int pIdx = 0; pIdx < numProtocols; pIdx++) {
|
2007-12-20 01:27:04 +03:00
|
|
|
if ((MethodDecl = protocols[pIdx]->getInstanceMethod(Sel)))
|
2007-12-15 02:37:57 +03:00
|
|
|
return MethodDecl;
|
2007-10-15 03:13:51 +04:00
|
|
|
}
|
2007-10-14 22:27:41 +04:00
|
|
|
// Didn't find one yet - now look through categories.
|
2008-01-07 22:49:32 +03:00
|
|
|
ObjCCategoryDecl *CatDecl = ClassDecl->getCategoryList();
|
2007-10-14 22:27:41 +04:00
|
|
|
while (CatDecl) {
|
2007-12-20 01:27:04 +03:00
|
|
|
if ((MethodDecl = CatDecl->getInstanceMethod(Sel)))
|
2007-12-15 02:37:57 +03:00
|
|
|
return MethodDecl;
|
2007-10-14 22:27:41 +04:00
|
|
|
CatDecl = CatDecl->getNextClassCategory();
|
|
|
|
}
|
2007-10-03 00:01:56 +04:00
|
|
|
ClassDecl = ClassDecl->getSuperClass();
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2007-10-14 22:27:41 +04:00
|
|
|
// lookupClassMethod - This method returns a class method by looking in the
|
2007-12-12 11:17:45 +03:00
|
|
|
// class, its categories, and its super classes (using a linear search).
|
2008-01-07 22:49:32 +03:00
|
|
|
ObjCMethodDecl *ObjCInterfaceDecl::lookupClassMethod(Selector Sel) {
|
|
|
|
ObjCInterfaceDecl* ClassDecl = this;
|
|
|
|
ObjCMethodDecl *MethodDecl = 0;
|
2007-12-15 02:37:57 +03:00
|
|
|
|
2007-10-03 00:01:56 +04:00
|
|
|
while (ClassDecl != NULL) {
|
2007-12-20 01:27:04 +03:00
|
|
|
if ((MethodDecl = ClassDecl->getClassMethod(Sel)))
|
2007-12-15 02:37:57 +03:00
|
|
|
return MethodDecl;
|
|
|
|
|
2007-10-15 03:13:51 +04:00
|
|
|
// Didn't find one yet - look through protocols.
|
2008-01-07 22:49:32 +03:00
|
|
|
ObjCProtocolDecl **protocols = ClassDecl->getReferencedProtocols();
|
2007-10-15 03:13:51 +04:00
|
|
|
int numProtocols = ClassDecl->getNumIntfRefProtocols();
|
|
|
|
for (int pIdx = 0; pIdx < numProtocols; pIdx++) {
|
2007-12-20 01:27:04 +03:00
|
|
|
if ((MethodDecl = protocols[pIdx]->getClassMethod(Sel)))
|
2007-12-15 02:37:57 +03:00
|
|
|
return MethodDecl;
|
2007-10-15 03:13:51 +04:00
|
|
|
}
|
2007-10-14 22:27:41 +04:00
|
|
|
// Didn't find one yet - now look through categories.
|
2008-01-07 22:49:32 +03:00
|
|
|
ObjCCategoryDecl *CatDecl = ClassDecl->getCategoryList();
|
2007-10-14 22:27:41 +04:00
|
|
|
while (CatDecl) {
|
2007-12-20 01:27:04 +03:00
|
|
|
if ((MethodDecl = CatDecl->getClassMethod(Sel)))
|
2007-12-15 02:37:57 +03:00
|
|
|
return MethodDecl;
|
2007-10-14 22:27:41 +04:00
|
|
|
CatDecl = CatDecl->getNextClassCategory();
|
|
|
|
}
|
2007-10-03 00:01:56 +04:00
|
|
|
ClassDecl = ClassDecl->getSuperClass();
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2007-12-12 10:30:05 +03:00
|
|
|
/// lookupInstanceMethod - This method returns an instance method by looking in
|
|
|
|
/// the class implementation. Unlike interfaces, we don't look outside the
|
|
|
|
/// implementation.
|
2008-01-07 22:49:32 +03:00
|
|
|
ObjCMethodDecl *ObjCImplementationDecl::getInstanceMethod(Selector Sel) {
|
2007-12-12 10:30:05 +03:00
|
|
|
for (instmeth_iterator I = instmeth_begin(), E = instmeth_end(); I != E; ++I)
|
|
|
|
if ((*I)->getSelector() == Sel)
|
|
|
|
return *I;
|
2007-11-11 03:10:47 +03:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2007-12-12 10:30:05 +03:00
|
|
|
/// lookupClassMethod - This method returns a class method by looking in
|
|
|
|
/// the class implementation. Unlike interfaces, we don't look outside the
|
|
|
|
/// implementation.
|
2008-01-07 22:49:32 +03:00
|
|
|
ObjCMethodDecl *ObjCImplementationDecl::getClassMethod(Selector Sel) {
|
2007-12-12 10:46:12 +03:00
|
|
|
for (classmeth_iterator I = classmeth_begin(), E = classmeth_end();
|
|
|
|
I != E; ++I)
|
|
|
|
if ((*I)->getSelector() == Sel)
|
|
|
|
return *I;
|
2007-11-11 03:10:47 +03:00
|
|
|
return NULL;
|
|
|
|
}
|
2007-09-18 01:07:36 +04:00
|
|
|
|
2007-11-13 01:05:31 +03:00
|
|
|
// lookupInstanceMethod - This method returns an instance method by looking in
|
|
|
|
// the class implementation. Unlike interfaces, we don't look outside the
|
|
|
|
// implementation.
|
2008-01-07 22:49:32 +03:00
|
|
|
ObjCMethodDecl *ObjCCategoryImplDecl::getInstanceMethod(Selector Sel) {
|
2007-12-12 10:46:12 +03:00
|
|
|
for (instmeth_iterator I = instmeth_begin(), E = instmeth_end(); I != E; ++I)
|
|
|
|
if ((*I)->getSelector() == Sel)
|
|
|
|
return *I;
|
2007-11-13 01:05:31 +03:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// lookupClassMethod - This method returns an instance method by looking in
|
|
|
|
// the class implementation. Unlike interfaces, we don't look outside the
|
|
|
|
// implementation.
|
2008-01-07 22:49:32 +03:00
|
|
|
ObjCMethodDecl *ObjCCategoryImplDecl::getClassMethod(Selector Sel) {
|
2007-12-12 10:46:12 +03:00
|
|
|
for (classmeth_iterator I = classmeth_begin(), E = classmeth_end();
|
|
|
|
I != E; ++I)
|
|
|
|
if ((*I)->getSelector() == Sel)
|
|
|
|
return *I;
|
2007-11-13 01:05:31 +03:00
|
|
|
return NULL;
|
|
|
|
}
|
2007-12-08 00:21:21 +03:00
|
|
|
|
|
|
|
// lookupInstanceMethod - Lookup a instance method in the protocol and protocols
|
|
|
|
// it inherited.
|
2008-01-07 22:49:32 +03:00
|
|
|
ObjCMethodDecl *ObjCProtocolDecl::lookupInstanceMethod(Selector Sel) {
|
|
|
|
ObjCMethodDecl *MethodDecl = NULL;
|
2007-12-15 02:37:57 +03:00
|
|
|
|
2007-12-20 01:27:04 +03:00
|
|
|
if ((MethodDecl = getInstanceMethod(Sel)))
|
2007-12-15 02:37:57 +03:00
|
|
|
return MethodDecl;
|
|
|
|
|
2007-12-08 00:21:21 +03:00
|
|
|
if (getNumReferencedProtocols() > 0) {
|
2008-01-07 22:49:32 +03:00
|
|
|
ObjCProtocolDecl **RefPDecl = getReferencedProtocols();
|
2007-12-08 00:21:21 +03:00
|
|
|
|
2007-12-20 22:24:10 +03:00
|
|
|
for (unsigned i = 0; i < getNumReferencedProtocols(); i++) {
|
2007-12-20 01:27:04 +03:00
|
|
|
if ((MethodDecl = RefPDecl[i]->getInstanceMethod(Sel)))
|
2007-12-15 02:37:57 +03:00
|
|
|
return MethodDecl;
|
2007-12-08 00:21:21 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// lookupInstanceMethod - Lookup a class method in the protocol and protocols
|
|
|
|
// it inherited.
|
2008-01-07 22:49:32 +03:00
|
|
|
ObjCMethodDecl *ObjCProtocolDecl::lookupClassMethod(Selector Sel) {
|
|
|
|
ObjCMethodDecl *MethodDecl = NULL;
|
2007-12-15 02:37:57 +03:00
|
|
|
|
2007-12-20 01:27:04 +03:00
|
|
|
if ((MethodDecl = getClassMethod(Sel)))
|
2007-12-15 02:37:57 +03:00
|
|
|
return MethodDecl;
|
|
|
|
|
2007-12-08 00:21:21 +03:00
|
|
|
if (getNumReferencedProtocols() > 0) {
|
2008-01-07 22:49:32 +03:00
|
|
|
ObjCProtocolDecl **RefPDecl = getReferencedProtocols();
|
2007-12-08 00:21:21 +03:00
|
|
|
|
2007-12-20 22:24:10 +03:00
|
|
|
for(unsigned i = 0; i < getNumReferencedProtocols(); i++) {
|
2007-12-20 01:27:04 +03:00
|
|
|
if ((MethodDecl = RefPDecl[i]->getClassMethod(Sel)))
|
2007-12-15 02:37:57 +03:00
|
|
|
return MethodDecl;
|
2007-12-08 00:21:21 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
2007-12-15 02:37:57 +03:00
|
|
|
|
2008-01-17 20:37:26 +03:00
|
|
|
/// getSynthesizedMethodSize - Compute size of synthesized method name
|
|
|
|
/// as done be the rewrite.
|
|
|
|
///
|
|
|
|
unsigned ObjCMethodDecl::getSynthesizedMethodSize() const {
|
2008-01-17 04:36:09 +03:00
|
|
|
// syntesized method name is a concatenation of -/+[class-name selector]
|
|
|
|
// Get length of this name.
|
2008-01-17 20:37:26 +03:00
|
|
|
unsigned length = 3; // _I_ or _C_
|
|
|
|
length += strlen(getClassInterface()->getName()) +1; // extra for _
|
|
|
|
NamedDecl *MethodContext = getMethodContext();
|
|
|
|
if (ObjCCategoryImplDecl *CID =
|
|
|
|
dyn_cast<ObjCCategoryImplDecl>(MethodContext))
|
|
|
|
length += strlen(CID->getName()) +1;
|
|
|
|
length += getSelector().getName().size(); // selector name
|
2008-01-17 04:36:09 +03:00
|
|
|
return length;
|
|
|
|
}
|
|
|
|
|
2008-01-07 22:49:32 +03:00
|
|
|
ObjCInterfaceDecl *const ObjCMethodDecl::getClassInterface() const {
|
|
|
|
if (ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(MethodContext))
|
2007-12-15 02:37:57 +03:00
|
|
|
return ID;
|
2008-01-07 22:49:32 +03:00
|
|
|
if (ObjCCategoryDecl *CD = dyn_cast<ObjCCategoryDecl>(MethodContext))
|
2007-12-15 02:37:57 +03:00
|
|
|
return CD->getClassInterface();
|
2008-01-07 22:49:32 +03:00
|
|
|
if (ObjCImplementationDecl *IMD =
|
|
|
|
dyn_cast<ObjCImplementationDecl>(MethodContext))
|
2007-12-15 02:37:57 +03:00
|
|
|
return IMD->getClassInterface();
|
2008-01-07 22:49:32 +03:00
|
|
|
if (ObjCCategoryImplDecl *CID =
|
|
|
|
dyn_cast<ObjCCategoryImplDecl>(MethodContext))
|
2007-12-15 02:37:57 +03:00
|
|
|
return CID->getClassInterface();
|
|
|
|
assert(false && "unknown method context");
|
|
|
|
return 0;
|
|
|
|
}
|