]> granicus.if.org Git - clang/commitdiff
Objective-C (mostly arc): Under ARC, we often have unneeded qualifiers
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 30 Apr 2013 00:30:48 +0000 (00:30 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 30 Apr 2013 00:30:48 +0000 (00:30 +0000)
in the diagnostics. Remove them when reporting incompatible
Objective-C pointer types. // rdar://13752880.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180765 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExpr.cpp
test/SemaObjC/arc.m

index f5900c06c79445e704ae61c4e5ef735927f0c304..173ee1e7f81375a647165ef89f3eda97c62914c9 100644 (file)
@@ -10170,6 +10170,10 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
     if (Hint.isNull() && !CheckInferredResultType) {
       ConvHints.tryToFixConversion(SrcExpr, SrcType, DstType, *this);
     }
+    else if (CheckInferredResultType) {
+      SrcType = SrcType.getUnqualifiedType();
+      DstType = DstType.getUnqualifiedType();
+    }
     MayHaveConvFixit = true;
     break;
   case IncompatiblePointerSign:
index d89d035fca21c54c62cd5ead43951f170e79cbb5..1d4e42de649da1077c464b579e84badc453928c4 100644 (file)
@@ -756,3 +756,14 @@ void rdar12569201(id key, id value) {
 @interface C
 - (void)method:(id[])objects; // expected-error{{must explicitly describe intended ownership of an object array parameter}}
 @end
+
+// rdar://13752880
+@interface NSMutableArray : NSArray @end
+
+typedef __strong NSMutableArray * PSNS;
+
+void test(NSArray *x) {
+  NSMutableArray *y = x; // expected-warning {{incompatible pointer types initializing 'NSMutableArray *' with an expression of type 'NSArray *'}}
+  __strong NSMutableArray *y1 = x; // expected-warning {{incompatible pointer types initializing 'NSMutableArray *' with an expression of type 'NSArray *'}}
+  PSNS y2 = x; // expected-warning {{incompatible pointer types initializing 'NSMutableArray *' with an expression of type 'NSArray *'}}
+}