diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2008-12-06 01:12:43 +0000 | 
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2008-12-06 01:12:43 +0000 | 
| commit | 5a3422f6029f8e3d3ab62c3ffd491195485a67e7 (patch) | |
| tree | ac2a7fe1ecdd2c485f7083ed9670fd0eac37b94f /clang/lib/Sema/SemaDeclObjC.cpp | |
| parent | 57e91eaf61e4b32723b44c1908daab407fdeac79 (diff) | |
| download | bcm5719-llvm-5a3422f6029f8e3d3ab62c3ffd491195485a67e7.tar.gz bcm5719-llvm-5a3422f6029f8e3d3ab62c3ffd491195485a67e7.zip | |
Patch to diagnose a variety of misuse of property
attributes. Example would be, readonly, assign or
assign, copy, etc.
llvm-svn: 60620
Diffstat (limited to 'clang/lib/Sema/SemaDeclObjC.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 18 | 
1 files changed, 14 insertions, 4 deletions
| diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 03c803054ca..19769b82e35 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -1229,12 +1229,22 @@ void Sema::CheckObjCPropertyAttributes(QualType PropertyTy,                                         unsigned &Attributes) {    // FIXME: Improve the reported location. -  // readonly and readwrite conflict. +  // readonly and readwrite/assign/retain/copy conflict.    if ((Attributes & ObjCDeclSpec::DQ_PR_readonly) && -      (Attributes & ObjCDeclSpec::DQ_PR_readwrite)) { +      (Attributes & (ObjCDeclSpec::DQ_PR_readwrite | +                     ObjCDeclSpec::DQ_PR_assign | +                     ObjCDeclSpec::DQ_PR_copy | +                     ObjCDeclSpec::DQ_PR_retain))) { +    const char * which = (Attributes & ObjCDeclSpec::DQ_PR_readwrite) ? +                          "readwrite" : +                         (Attributes & ObjCDeclSpec::DQ_PR_assign) ? +                          "assign" : +                         (Attributes & ObjCDeclSpec::DQ_PR_copy) ? +                          "copy" : "retain"; +                               Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) -      << "readonly" << "readwrite"; -    Attributes &= ~ObjCDeclSpec::DQ_PR_readonly; +      << "readonly" << which; +    return;    }    // Check for copy or retain on non-object types. | 

