[cfe-commits] r140571 - in /cfe/trunk: lib/Sema/SemaObjCProperty.cpp test/SemaObjC/arc-setter-property-match.m

Fariborz Jahanian fjahanian at apple.com
Mon Sep 26 17:12:27 CDT 2011


Author: fjahanian
Date: Mon Sep 26 17:12:27 2011
New Revision: 140571

URL: http://llvm.org/viewvc/llvm-project?rev=140571&view=rev
Log:
objc - in matching setter argument type to its property type,
ingore the type qualifiers. // rdar://10156674

Added:
    cfe/trunk/test/SemaObjC/arc-setter-property-match.m
Modified:
    cfe/trunk/lib/Sema/SemaObjCProperty.cpp

Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=140571&r1=140570&r2=140571&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Mon Sep 26 17:12:27 2011
@@ -1481,7 +1481,8 @@
           Context.VoidTy)
       Diag(SetterMethod->getLocation(), diag::err_setter_type_void);
     if (SetterMethod->param_size() != 1 ||
-        ((*SetterMethod->param_begin())->getType() != property->getType())) {
+        ((*SetterMethod->param_begin())->getType().getUnqualifiedType() 
+         != property->getType().getUnqualifiedType())) {
       Diag(property->getLocation(),
            diag::warn_accessor_property_type_mismatch)
         << property->getDeclName()

Added: cfe/trunk/test/SemaObjC/arc-setter-property-match.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/arc-setter-property-match.m?rev=140571&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjC/arc-setter-property-match.m (added)
+++ cfe/trunk/test/SemaObjC/arc-setter-property-match.m Mon Sep 26 17:12:27 2011
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -fblocks -verify %s
+// rdar://10156674
+
+ at class NSArray;
+
+ at interface MyClass2  {
+ at private
+    NSArray *_names1;
+    NSArray *_names2;
+    NSArray *_names3;
+    NSArray *_names4;
+}
+ at property (readwrite, strong) NSArray *names1; // <-- warning: Type of property....
+- (void)setNames1:(NSArray *)names;
+ at property (readwrite, strong) __strong NSArray *names2; // <-- warning: Type of property....
+- (void)setNames2:(NSArray *)names;
+ at property (readwrite, strong) __strong NSArray *names3; // <-- OK
+- (void)setNames3:(__strong NSArray *)names;
+ at property (readwrite, strong) NSArray *names4; // <-- warning: Type of property....
+- (void)setNames4:(__strong NSArray *)names;
+
+ at end
+
+ at implementation MyClass2
+- (NSArray *)names1 { return _names1; }
+- (void)setNames1:(NSArray *)names {}
+- (NSArray *)names2 { return _names2; }
+- (void)setNames2:(NSArray *)names {}
+- (NSArray *)names3 { return _names3; }
+- (void)setNames3:(__strong NSArray *)names {}
+- (NSArray *)names4 { return _names4; }
+- (void)setNames4:(__strong NSArray *)names {}
+
+ at end
+




More information about the cfe-commits mailing list