aboutsummaryrefslogtreecommitdiff
path: root/test/ARCMT
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-02-14 17:29:16 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-02-14 17:29:16 +0000
commit33ace0669393acb84c24a7ff7a80e8759777b3e8 (patch)
tree89c8517511aa65e8f65867dc40f07f078fe38ced /test/ARCMT
parent83dece57e3e3fd84dfd4299a89751e266e87c79d (diff)
[arcmt] Make sure the function has an associated parameter for the argument
before checking for its attributes. rdar://13192395 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175184 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/ARCMT')
-rw-r--r--test/ARCMT/nonobjc-to-objc-cast-2.m9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ARCMT/nonobjc-to-objc-cast-2.m b/test/ARCMT/nonobjc-to-objc-cast-2.m
index 80d694e586..e554c7da2d 100644
--- a/test/ARCMT/nonobjc-to-objc-cast-2.m
+++ b/test/ARCMT/nonobjc-to-objc-cast-2.m
@@ -54,3 +54,12 @@ CFStringRef f3() {
return (CFStringRef)[[[NSString alloc] init] autorelease]; // expected-error {{it is not safe to cast to 'CFStringRef' the result of 'autorelease' message; a __bridge cast may result in a pointer to a destroyed object and a __bridge_retained may leak the object}} \
// expected-note {{remove the cast and change return type of function to 'NSString *' to have the object automatically autoreleased}}
}
+
+extern void NSLog(NSString *format, ...);
+
+// rdar://13192395
+void f4(NSString *s) {
+ NSLog(@"%@", (CFStringRef)s); // expected-error {{cast of Objective-C pointer type 'NSString *' to C pointer type 'CFStringRef' (aka 'const struct __CFString *') requires a bridged cast}} \
+ // expected-note{{use __bridge to convert directly (no change in ownership)}} \
+ // expected-note{{use CFBridgingRetain call to make an ARC object available as a +1 'CFStringRef' (aka 'const struct __CFString *')}}
+}