summaryrefslogtreecommitdiff
path: root/test/FixIt
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2013-12-17 19:33:43 +0000
committerFariborz Jahanian <fjahanian@apple.com>2013-12-17 19:33:43 +0000
commit7fe35ba9ec58843b4b997d03daaaa219f1ad1d5f (patch)
treed1f8f2a3572872e3cff8cbbdf07135cab8c1645f /test/FixIt
parent9f14d0bddbc3ba49a19ea1fc4ff9452c61288af6 (diff)
downloadclang-7fe35ba9ec58843b4b997d03daaaa219f1ad1d5f.tar.gz
Objective-C. Make diagnostics and fix-its consistent
when diagnosing casting of a cstring literal to NSString in default and -fobjc-arc mode. // rdar://14106083 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197515 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/FixIt')
-rw-r--r--test/FixIt/fixit-objc-arc.m24
-rw-r--r--test/FixIt/fixit-objc.m8
2 files changed, 28 insertions, 4 deletions
diff --git a/test/FixIt/fixit-objc-arc.m b/test/FixIt/fixit-objc-arc.m
new file mode 100644
index 0000000000..19a61b4108
--- /dev/null
+++ b/test/FixIt/fixit-objc-arc.m
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -pedantic -verify %s
+// RUN: cp %s %t
+// RUN: not %clang_cc1 -pedantic -fobjc-arc -fixit -x objective-c %t
+// RUN: %clang_cc1 -pedantic -fobjc-arc -Werror -x objective-c %t
+// rdar://14106083
+
+@class A;
+@class NSString;
+
+@interface Test
+- (void)test:(NSString *)string; // expected-note{{passing argument to parameter 'string' here}}
+
+@property (copy) NSString *property;
+@end
+
+void g(NSString *a); // expected-note{{passing argument to parameter 'a' here}}
+void h(id a);
+
+void f(Test *t) {
+ NSString *a = "Foo"; // expected-error {{string literal must be prefixed by '@'}}
+ g("Foo"); // expected-error {{string literal must be prefixed by '@'}}
+ [t test:"Foo"]; // expected-error {{string literal must be prefixed by '@'}}
+ t.property = "Foo"; // expected-error {{string literal must be prefixed by '@'}}
+}
diff --git a/test/FixIt/fixit-objc.m b/test/FixIt/fixit-objc.m
index 7c4776ae71..17de36528e 100644
--- a/test/FixIt/fixit-objc.m
+++ b/test/FixIt/fixit-objc.m
@@ -27,13 +27,13 @@ void g(NSString *a); // expected-note{{passing argument to parameter 'a' here}}
void h(id a); // expected-note 2{{passing argument to parameter 'a' here}}
void f(Test *t) {
- NSString *a = "Foo"; // expected-warning {{string literal must be prefixed by '@'}}
+ NSString *a = "Foo"; // expected-error {{string literal must be prefixed by '@'}}
id b = "Foo"; // expected-warning {{incompatible pointer types initializing 'id' with an expression of type 'char [4]'}}
- g("Foo"); // expected-warning {{string literal must be prefixed by '@'}}
+ g("Foo"); // expected-error {{string literal must be prefixed by '@'}}
h("Foo"); // expected-warning{{incompatible pointer types passing 'char [4]' to parameter of type 'id'}}
h(("Foo")); // expected-warning{{incompatible pointer types passing 'char [4]' to parameter of type 'id'}}
- [t test:"Foo"]; // expected-warning {{string literal must be prefixed by '@'}}
- t.property = "Foo"; // expected-warning {{string literal must be prefixed by '@'}}
+ [t test:"Foo"]; // expected-error {{string literal must be prefixed by '@'}}
+ t.property = "Foo"; // expected-error {{string literal must be prefixed by '@'}}
// <rdar://problem/6896493>
[t test:@"Foo"]]; // expected-error{{extraneous ']' before ';'}}