[cfe-commits] r49821 - in /cfe/trunk: include/clang/AST/DeclBase.h include/clang/AST/DeclObjC.h lib/AST/Decl.cpp
Fariborz Jahanian
fjahanian at apple.com
Wed Apr 16 15:00:24 PDT 2008
Author: fjahanian
Date: Wed Apr 16 17:00:24 2008
New Revision: 49821
URL: http://llvm.org/viewvc/llvm-project?rev=49821&view=rev
Log:
New AST class for property implementation declarations.
Modified:
cfe/trunk/include/clang/AST/DeclBase.h
cfe/trunk/include/clang/AST/DeclObjC.h
cfe/trunk/lib/AST/Decl.cpp
Modified: cfe/trunk/include/clang/AST/DeclBase.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=49821&r1=49820&r2=49821&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Wed Apr 16 17:00:24 2008
@@ -62,6 +62,7 @@
ObjCMethod,
ObjCClass,
ObjCForwardProtocol,
+ ObjCPropertyImpl,
LinkageSpec,
FileScopeAsm,
Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=49821&r1=49820&r2=49821&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Wed Apr 16 17:00:24 2008
@@ -999,5 +999,45 @@
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
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=49821&r1=49820&r2=49821&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Wed Apr 16 17:00:24 2008
@@ -42,6 +42,7 @@
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 @@
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 @@
nObjCCategoryImpl*sizeof(ObjCCategoryImplDecl)+
nObjCCompatibleAlias*sizeof(ObjCCompatibleAliasDecl)+
nObjCPropertyDecl*sizeof(ObjCPropertyDecl)+
+ nObjCPropertyImplDecl*sizeof(ObjCPropertyImplDecl)+
nLinkageSpecDecl*sizeof(LinkageSpecDecl)+
nFileScopeAsmDecl*sizeof(FileScopeAsmDecl)));
@@ -189,6 +195,7 @@
case ObjCCategoryImpl: nObjCCategoryImpl++; break;
case ObjCCompatibleAlias: nObjCCompatibleAlias++; break;
case ObjCProperty: nObjCPropertyDecl++; break;
+ case ObjCPropertyImpl: nObjCPropertyImplDecl++; break;
case LinkageSpec: nLinkageSpecDecl++; break;
case FileScopeAsm: nFileScopeAsmDecl++; break;
}
More information about the cfe-commits
mailing list