diff options
-rw-r--r-- | Driver/ASTConsumers.cpp | 4 | ||||
-rw-r--r-- | include/clang/AST/DeclObjC.h | 15 | ||||
-rw-r--r-- | include/clang/Parse/Action.h | 1 | ||||
-rw-r--r-- | include/clang/Parse/DeclSpec.h | 3 | ||||
-rw-r--r-- | lib/Parse/ParseObjc.cpp | 5 | ||||
-rw-r--r-- | lib/Sema/Sema.h | 1 | ||||
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 6 | ||||
-rw-r--r-- | test/Sema/objc-property-3.m | 15 |
8 files changed, 23 insertions, 27 deletions
diff --git a/Driver/ASTConsumers.cpp b/Driver/ASTConsumers.cpp index 20d4ce2a88..45b2ad2bdd 100644 --- a/Driver/ASTConsumers.cpp +++ b/Driver/ASTConsumers.cpp @@ -337,12 +337,12 @@ void DeclPrinter::PrintObjCPropertyDecl(ObjCPropertyDecl *PDecl) { if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_getter) { Out << (first ? ' ' : ',') << "getter = " - << PDecl->getGetterName()->getName(); + << PDecl->getGetterName().getName(); first = false; } if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_setter) { Out << (first ? ' ' : ',') << "setter = " - << PDecl->getSetterName()->getName(); + << PDecl->getSetterName().getName(); first = false; } diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h index 7947b3dc38..509f0e0747 100644 --- a/include/clang/AST/DeclObjC.h +++ b/include/clang/AST/DeclObjC.h @@ -1075,12 +1075,13 @@ private: // @required/@optional unsigned PropertyImplementation : 2; - IdentifierInfo *GetterName; // getter name of NULL if no getter - IdentifierInfo *SetterName; // setter name of NULL if no setter + Selector GetterName; // getter name of NULL if no getter + Selector SetterName; // setter name of NULL if no setter ObjCPropertyDecl(SourceLocation L, IdentifierInfo *Id, QualType T) : NamedDecl(ObjCProperty, L, Id), DeclType(T), - PropertyAttributes(OBJC_PR_noattr), GetterName(0), SetterName(0) {} + PropertyAttributes(OBJC_PR_noattr), GetterName(Selector()), + SetterName(Selector()) {} public: static ObjCPropertyDecl *Create(ASTContext &C, SourceLocation L, IdentifierInfo *Id, QualType T, @@ -1095,11 +1096,11 @@ public: PropertyAttributes |= PRVal; } - IdentifierInfo *getGetterName() const { return GetterName; } - void setGetterName(IdentifierInfo *Id) { GetterName = Id; } + Selector getGetterName() const { return GetterName; } + void setGetterName(Selector Sel) { GetterName = Sel; } - IdentifierInfo *getSetterName() const { return SetterName; } - void setSetterName(IdentifierInfo *Id) { SetterName = Id; } + Selector getSetterName() const { return SetterName; } + void setSetterName(Selector Sel) { SetterName = Sel; } // Related to @optional/@required declared in @protocol void setPropertyImplementation(PropertyControl pc) { diff --git a/include/clang/Parse/Action.h b/include/clang/Parse/Action.h index 5d094ae892..17899d41d7 100644 --- a/include/clang/Parse/Action.h +++ b/include/clang/Parse/Action.h @@ -686,6 +686,7 @@ public: // ActOnProperty - called to build one property AST virtual DeclTy *ActOnProperty (Scope *S, SourceLocation AtLoc, FieldDeclarator &FD, ObjCDeclSpec &ODS, + Selector GetterSel, Selector SetterSel, tok::ObjCKeywordKind MethodImplKind) { return 0; } diff --git a/include/clang/Parse/DeclSpec.h b/include/clang/Parse/DeclSpec.h index 4bd6204b04..369aca480d 100644 --- a/include/clang/Parse/DeclSpec.h +++ b/include/clang/Parse/DeclSpec.h @@ -329,7 +329,8 @@ public: }; - ObjCDeclSpec() : objcDeclQualifier(DQ_None), PropertyAttributes(DQ_PR_noattr) + ObjCDeclSpec() : objcDeclQualifier(DQ_None), PropertyAttributes(DQ_PR_noattr), + GetterName(0), SetterName(0) {} ObjCDeclQualifier getObjCDeclQualifier() const { return objcDeclQualifier; } void setObjCDeclQualifier(ObjCDeclQualifier DQVal) diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index 8d404a9aaf..1ff5877d2c 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -270,8 +270,13 @@ void Parser::ParseObjCInterfaceDeclList(DeclTy *interfaceDecl, for (unsigned i = 0, e = FieldDeclarators.size(); i != e; ++i) { FieldDeclarator &FD = FieldDeclarators[i]; // Install the property declarator into interfaceDecl. + Selector GetterSel = + PP.getSelectorTable().getNullarySelector(OCDS.getGetterName()); + Selector SetterSel = + PP.getSelectorTable().getNullarySelector(OCDS.getSetterName()); DeclTy *Property = Actions.ActOnProperty(CurScope, DS.getSourceRange().getBegin(), FD, OCDS, + GetterSel, SetterSel, MethodImplKind); allProperties.push_back(Property); } diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index 5541808ac9..27eca89ab2 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -677,6 +677,7 @@ public: virtual DeclTy *ActOnProperty(Scope *S, SourceLocation AtLoc, FieldDeclarator &FD, ObjCDeclSpec &ODS, + Selector GetterSel, Selector SetterSel, tok::ObjCKeywordKind MethodImplKind); virtual DeclTy *ActOnPropertyImplDecl(SourceLocation AtLoc, diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 3b48810896..f9e4f5b14d 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -1023,6 +1023,8 @@ Sema::DeclTy *Sema::ActOnMethodDeclaration( Sema::DeclTy *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc, FieldDeclarator &FD, ObjCDeclSpec &ODS, + Selector GetterSel, + Selector SetterSel, tok::ObjCKeywordKind MethodImplKind) { QualType T = GetTypeForDeclarator(FD.D, S); ObjCPropertyDecl *PDecl = ObjCPropertyDecl::Create(Context, AtLoc, @@ -1033,12 +1035,12 @@ Sema::DeclTy *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc, if (ODS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_getter) { PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_getter); - PDecl->setGetterName(ODS.getGetterName()); + PDecl->setGetterName(GetterSel); } if (ODS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_setter) { PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_setter); - PDecl->setSetterName(ODS.getSetterName()); + PDecl->setSetterName(SetterSel); } if (ODS.getPropertyAttributes() & ObjCDeclSpec::DQ_PR_assign) diff --git a/test/Sema/objc-property-3.m b/test/Sema/objc-property-3.m index dd45ab43f4..e69de29bb2 100644 --- a/test/Sema/objc-property-3.m +++ b/test/Sema/objc-property-3.m @@ -1,15 +0,0 @@ -// RUN: clang -verify %s - -@interface I -{ - id d1; -} -@property (readwrite, copy) id d1; -@property (readwrite, copy) id d2; -@end - -@interface NOW : I -@property (readonly, retain) id d1; // expected-warning {{attribute 'readonly' of property 'd1' restricts attribute 'readwrite' of property inherited from 'I'}} expected-warning {{property 'd1' 'copy' attribute does not match the property inherited from'I'}} -@property (readwrite, copy) I* d2; // expected-warning {{property type 'I *' does not match property type inherited from 'I'}} -@end - |