aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclObjC.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2008-04-11 23:40:25 +0000
committerFariborz Jahanian <fjahanian@apple.com>2008-04-11 23:40:25 +0000
commitdae1a1a2aa4f245b1958dc8db6089f24c575ef13 (patch)
tree1f7ac919a3f7a1140e32a69acac688228120841a /lib/Sema/SemaDeclObjC.cpp
parente7bd9c20a9310c625bef899dec977aba688db06a (diff)
AST generation for objc2's property declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49565 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r--lib/Sema/SemaDeclObjC.cpp47
1 files changed, 28 insertions, 19 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 776a50f6f2..7eb132ec40 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -886,43 +886,52 @@ Sema::DeclTy *Sema::ActOnMethodDeclaration(
return ObjCMethod;
}
-Sema::DeclTy *Sema::ActOnAddObjCProperties(SourceLocation AtLoc,
- DeclTy **allProperties,
- unsigned NumProperties,
- ObjCDeclSpec &DS) {
- ObjCPropertyDecl *PDecl = ObjCPropertyDecl::Create(Context, AtLoc);
-
- if (DS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_readonly)
+Sema::DeclTy *Sema::ActOnAddObjCProperties(Scope *S, SourceLocation AtLoc,
+ FieldDeclarator *propertyDeclarators,
+ unsigned NumPropertyDeclarators,
+ ObjCDeclSpec &ODS) {
+ FieldDeclarator &FD = propertyDeclarators[0];
+ QualType T = GetTypeForDeclarator(FD.D, S);
+ ObjCPropertyDecl *PDecl = ObjCPropertyDecl::Create(Context, AtLoc, T);
+
+ if (ODS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_readonly)
PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_readonly);
- if (DS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_getter) {
+ if (ODS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_getter) {
PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_getter);
- PDecl->setGetterName(DS.getGetterName());
+ PDecl->setGetterName(ODS.getGetterName());
}
- if (DS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_setter) {
+ if (ODS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_setter) {
PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_setter);
- PDecl->setSetterName(DS.getSetterName());
+ PDecl->setSetterName(ODS.getSetterName());
}
- if (DS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_assign)
+ if (ODS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_assign)
PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_assign);
- if (DS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_readwrite)
+ if (ODS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_readwrite)
PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_readwrite);
- if (DS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_retain)
+ if (ODS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_retain)
PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_retain);
- if (DS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_copy)
+ if (ODS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_copy)
PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_copy);
- if (DS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_nonatomic)
+ if (ODS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_nonatomic)
PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_nonatomic);
- if (NumProperties != 0)
- PDecl->setPropertyDeclLists((ObjCIvarDecl**)allProperties, NumProperties);
-
+ if (NumPropertyDeclarators != 0) {
+ NamedDecl **propertyName = new NamedDecl*[NumPropertyDeclarators];
+ PDecl->setPropertyDecls(propertyName);
+ PDecl->setNumPropertyDecls(NumPropertyDeclarators);
+ for (unsigned i = 0; i < NumPropertyDeclarators; i++) {
+ Declarator &D = propertyDeclarators[i].D;
+ propertyName[i] = new NamedDecl(Decl::ObjCProperty,
+ D.getIdentifierLoc(), D.getIdentifier());
+ }
+ }
return PDecl;
}