diff options
author | Anders Carlsson <andersca@mac.com> | 2009-11-10 04:46:30 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-11-10 04:46:30 +0000 |
commit | ace5d07e50aeb925d46a43cfca3c022774e5dbf3 (patch) | |
tree | 8b4196495df7fdcfea9aa7148474d48a3dac39a5 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp | |
parent | 7ddc6a98a7491b78dbc3eeed91fd49a85e021526 (diff) | |
download | bcm5719-llvm-ace5d07e50aeb925d46a43cfca3c022774e5dbf3.tar.gz bcm5719-llvm-ace5d07e50aeb925d46a43cfca3c022774e5dbf3.zip |
When trying to assign a regular string literal to an Objective-C 'id' type or a pointer to an NSString, emit a code insertion hint that turns it into an Objective-C string. For example:
@class NSString;
@interface Test
+ (void)test:(NSString *)string;
@end
void g(NSString *a);
void f() {
NSString *a = "Foo";
g("Foo");
[Test test:"Foo"];
}
will produce
t.m:10:17: warning: incompatible pointer types initializing 'char [4]', expected 'NSString *'
NSString *a = "Foo";
^~~~~
@
t.m:11:5: warning: incompatible pointer types passing 'char [4]', expected 'NSString *'
g("Foo");
^~~~~
@
t.m:12:14: warning: incompatible pointer types sending 'char [4]', expected 'NSString *'
[Test test:"Foo"];
^~~~~
@
3 diagnostics generated.
llvm-svn: 86665
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
0 files changed, 0 insertions, 0 deletions