diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:31:20 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:31:20 +0000 | 
| commit | 20e90f04ad65d84361f769ef539883f75e3ef80d (patch) | |
| tree | 6f84b34d122575877ff298feeb61ee7bd0b66f78 /contrib/llvm/tools/clang/lib/Sema/SemaObjCProperty.cpp | |
| parent | 7a7e6055035bfd93ab507051819373a6f171258b (diff) | |
| parent | 7442d6faa2719e4e7d33a7021c406c5a4facd74d (diff) | |
Notes
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Sema/SemaObjCProperty.cpp')
| -rw-r--r-- | contrib/llvm/tools/clang/lib/Sema/SemaObjCProperty.cpp | 37 | 
1 files changed, 21 insertions, 16 deletions
diff --git a/contrib/llvm/tools/clang/lib/Sema/SemaObjCProperty.cpp b/contrib/llvm/tools/clang/lib/Sema/SemaObjCProperty.cpp index 3481b82679c2..6c5716454874 100644 --- a/contrib/llvm/tools/clang/lib/Sema/SemaObjCProperty.cpp +++ b/contrib/llvm/tools/clang/lib/Sema/SemaObjCProperty.cpp @@ -200,9 +200,10 @@ Decl *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc,    if (ObjCCategoryDecl *CDecl = dyn_cast<ObjCCategoryDecl>(ClassDecl)) {      if (CDecl->IsClassExtension()) {        Res = HandlePropertyInClassExtension(S, AtLoc, LParenLoc, -                                           FD, GetterSel, SetterSel, -                                           isReadWrite, -                                           Attributes, +                                           FD, +                                           GetterSel, ODS.getGetterNameLoc(), +                                           SetterSel, ODS.getSetterNameLoc(), +                                           isReadWrite, Attributes,                                             ODS.getPropertyAttributes(),                                             T, TSI, MethodImplKind);        if (!Res) @@ -212,9 +213,10 @@ Decl *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc,    if (!Res) {      Res = CreatePropertyDecl(S, ClassDecl, AtLoc, LParenLoc, FD, -                             GetterSel, SetterSel, isReadWrite, -                             Attributes, ODS.getPropertyAttributes(), -                             T, TSI, MethodImplKind); +                             GetterSel, ODS.getGetterNameLoc(), SetterSel, +                             ODS.getSetterNameLoc(), isReadWrite, Attributes, +                             ODS.getPropertyAttributes(), T, TSI, +                             MethodImplKind);      if (lexicalDC)        Res->setLexicalDeclContext(lexicalDC);    } @@ -412,7 +414,10 @@ Sema::HandlePropertyInClassExtension(Scope *S,                                       SourceLocation AtLoc,                                       SourceLocation LParenLoc,                                       FieldDeclarator &FD, -                                     Selector GetterSel, Selector SetterSel, +                                     Selector GetterSel, +                                     SourceLocation GetterNameLoc, +                                     Selector SetterSel, +                                     SourceLocation SetterNameLoc,                                       const bool isReadWrite,                                       unsigned &Attributes,                                       const unsigned AttributesAsWritten, @@ -512,7 +517,8 @@ Sema::HandlePropertyInClassExtension(Scope *S,    // Create a new ObjCPropertyDecl with the DeclContext being    // the class extension.    ObjCPropertyDecl *PDecl = CreatePropertyDecl(S, CDecl, AtLoc, LParenLoc, -                                               FD, GetterSel, SetterSel, +                                               FD, GetterSel, GetterNameLoc, +                                               SetterSel, SetterNameLoc,                                                 isReadWrite,                                                 Attributes, AttributesAsWritten,                                                 T, TSI, MethodImplKind, DC); @@ -562,7 +568,9 @@ ObjCPropertyDecl *Sema::CreatePropertyDecl(Scope *S,                                             SourceLocation LParenLoc,                                             FieldDeclarator &FD,                                             Selector GetterSel, +                                           SourceLocation GetterNameLoc,                                             Selector SetterSel, +                                           SourceLocation SetterNameLoc,                                             const bool isReadWrite,                                             const unsigned Attributes,                                             const unsigned AttributesAsWritten, @@ -640,8 +648,8 @@ ObjCPropertyDecl *Sema::CreatePropertyDecl(Scope *S,    // Regardless of setter/getter attribute, we save the default getter/setter    // selector names in anticipation of declaration of setter/getter methods. -  PDecl->setGetterName(GetterSel); -  PDecl->setSetterName(SetterSel); +  PDecl->setGetterName(GetterSel, GetterNameLoc); +  PDecl->setSetterName(SetterSel, SetterNameLoc);    PDecl->setPropertyAttributesAsWritten(                            makePropertyAttributesAsWritten(AttributesAsWritten)); @@ -2177,12 +2185,9 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property) {    DiagnosePropertyAccessorMismatch(property, GetterMethod,                                     property->getLocation()); -  if (SetterMethod) { -    ObjCPropertyDecl::PropertyAttributeKind CAttr = -      property->getPropertyAttributes(); -    if ((!(CAttr & ObjCPropertyDecl::OBJC_PR_readonly)) && -        Context.getCanonicalType(SetterMethod->getReturnType()) != -            Context.VoidTy) +  if (!property->isReadOnly() && SetterMethod) { +    if (Context.getCanonicalType(SetterMethod->getReturnType()) != +        Context.VoidTy)        Diag(SetterMethod->getLocation(), diag::err_setter_type_void);      if (SetterMethod->param_size() != 1 ||          !Context.hasSameUnqualifiedType(  | 
