зеркало из https://github.com/microsoft/clang-1.git
New AST class for property implementation declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49821 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
d9a3c330b0
Коммит
61d46159af
|
@ -62,6 +62,7 @@ public:
|
|||
ObjCMethod,
|
||||
ObjCClass,
|
||||
ObjCForwardProtocol,
|
||||
ObjCPropertyImpl,
|
||||
LinkageSpec,
|
||||
FileScopeAsm,
|
||||
|
||||
|
|
|
@ -999,5 +999,45 @@ public:
|
|||
static bool classof(const ObjCPropertyDecl *D) { return true; }
|
||||
};
|
||||
|
||||
/// ObjCPropertyImplDecl - Represents implementation declaration of a property
|
||||
/// in a class or category implementation block. For example:
|
||||
/// @synthesize prop1 = ivar1;
|
||||
///
|
||||
class ObjCPropertyImplDecl : public Decl {
|
||||
public:
|
||||
enum PropertyImplKind {
|
||||
OBJC_PR_IMPL_None,
|
||||
OBJC_PR_IMPL_SYNTHSIZE,
|
||||
OBJC_PR_IMPL_DYNAMIC
|
||||
};
|
||||
private:
|
||||
/// Property declaration being implemented
|
||||
ObjCPropertyDecl *PropertyDecl;
|
||||
PropertyImplKind PropertyImplementation;
|
||||
/// Null for @dynamic. Required for @synthesize.
|
||||
ObjCIvarDecl *PropertyIvarDecl;
|
||||
public:
|
||||
ObjCPropertyImplDecl(SourceLocation L)
|
||||
: Decl(ObjCPropertyImpl, L), PropertyDecl(0),
|
||||
PropertyImplementation(OBJC_PR_IMPL_None), PropertyIvarDecl(0) {}
|
||||
|
||||
void setPropertyDecl(ObjCPropertyDecl *property) { PropertyDecl = property; }
|
||||
ObjCPropertyDecl *getPropertyDecl() const { return PropertyDecl; }
|
||||
|
||||
void setImplKind (PropertyImplKind propImplKind)
|
||||
{ PropertyImplementation = propImplKind; }
|
||||
PropertyImplKind getPropertyImplementation() const
|
||||
{ return PropertyImplementation; }
|
||||
|
||||
void setPropertyIvarDecl(ObjCIvarDecl *ivarDecl)
|
||||
{ PropertyIvarDecl = ivarDecl; }
|
||||
ObjCIvarDecl *getPropertyIvarDecl() { return PropertyIvarDecl; }
|
||||
|
||||
static bool classof(const Decl *D) {
|
||||
return D->getKind() == ObjCPropertyImpl;
|
||||
}
|
||||
static bool classof(const ObjCPropertyImplDecl *D) { return true; }
|
||||
};
|
||||
|
||||
} // end namespace clang
|
||||
#endif
|
||||
|
|
|
@ -42,6 +42,7 @@ static unsigned nObjCImplementationDecls = 0;
|
|||
static unsigned nObjCCategoryImpl = 0;
|
||||
static unsigned nObjCCompatibleAlias = 0;
|
||||
static unsigned nObjCPropertyDecl = 0;
|
||||
static unsigned nObjCPropertyImplDecl = 0;
|
||||
static unsigned nLinkageSpecDecl = 0;
|
||||
static unsigned nFileScopeAsmDecl = 0;
|
||||
|
||||
|
@ -146,6 +147,10 @@ void Decl::PrintStats() {
|
|||
nObjCPropertyDecl, (int)sizeof(ObjCPropertyDecl),
|
||||
int(nObjCPropertyDecl*sizeof(ObjCPropertyDecl)));
|
||||
|
||||
fprintf(stderr, " %d property implementation decls, %d each (%d bytes)\n",
|
||||
nObjCPropertyImplDecl, (int)sizeof(ObjCPropertyImplDecl),
|
||||
int(nObjCPropertyImplDecl*sizeof(ObjCPropertyImplDecl)));
|
||||
|
||||
fprintf(stderr, "Total bytes = %d\n",
|
||||
int(nFuncs*sizeof(FunctionDecl)+
|
||||
nVars*sizeof(VarDecl)+nParmVars*sizeof(ParmVarDecl)+
|
||||
|
@ -163,6 +168,7 @@ void Decl::PrintStats() {
|
|||
nObjCCategoryImpl*sizeof(ObjCCategoryImplDecl)+
|
||||
nObjCCompatibleAlias*sizeof(ObjCCompatibleAliasDecl)+
|
||||
nObjCPropertyDecl*sizeof(ObjCPropertyDecl)+
|
||||
nObjCPropertyImplDecl*sizeof(ObjCPropertyImplDecl)+
|
||||
nLinkageSpecDecl*sizeof(LinkageSpecDecl)+
|
||||
nFileScopeAsmDecl*sizeof(FileScopeAsmDecl)));
|
||||
|
||||
|
@ -189,6 +195,7 @@ void Decl::addDeclKind(Kind k) {
|
|||
case ObjCCategoryImpl: nObjCCategoryImpl++; break;
|
||||
case ObjCCompatibleAlias: nObjCCompatibleAlias++; break;
|
||||
case ObjCProperty: nObjCPropertyDecl++; break;
|
||||
case ObjCPropertyImpl: nObjCPropertyImplDecl++; break;
|
||||
case LinkageSpec: nLinkageSpecDecl++; break;
|
||||
case FileScopeAsm: nFileScopeAsmDecl++; break;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче