summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2013-04-30 00:30:48 +0000
committerFariborz Jahanian <fjahanian@apple.com>2013-04-30 00:30:48 +0000
commit3beec2080f809b00f38c149fe0175604332f1830 (patch)
tree7dcc037d68f420750f0662e269142056c5a52dbf
parent116ace2125e52b2e1625526a0df28340578fe982 (diff)
downloadbcm5719-llvm-3beec2080f809b00f38c149fe0175604332f1830.tar.gz
bcm5719-llvm-3beec2080f809b00f38c149fe0175604332f1830.zip
Objective-C (mostly arc): Under ARC, we often have unneeded qualifiers
in the diagnostics. Remove them when reporting incompatible Objective-C pointer types. // rdar://13752880. llvm-svn: 180765
-rw-r--r--clang/lib/Sema/SemaExpr.cpp4
-rw-r--r--clang/test/SemaObjC/arc.m11
2 files changed, 15 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index f5900c06c79..173ee1e7f81 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -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:
diff --git a/clang/test/SemaObjC/arc.m b/clang/test/SemaObjC/arc.m
index d89d035fca2..1d4e42de649 100644
--- a/clang/test/SemaObjC/arc.m
+++ b/clang/test/SemaObjC/arc.m
@@ -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 *'}}
+}
OpenPOWER on IntegriCloud