Debian Codegraph @

clang/test/Parser/objc-boxing.m

raw
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2
3 @interface NSString @end
4
5 @interface NSString (NSStringExtensionMethods)
6 + (id)stringWithUTF8String:(const char *)nullTerminatedCString;
7 @end
8
9 extern char *strdup(const char *str);
10
11 id constant_string(void) {
12 return @("boxed constant string.");
13 }
14
15 id dynamic_string(void) {
16 return @(strdup("boxed dynamic string"));
17 }
18
19 id const_char_pointer(void) {
20 return @((const char *)"constant character pointer");
21 }
22
23 id missing_parentheses(void) {
24 return @(5; // expected-error {{expected ')'}} \
25 // expected-note {{to match this '('}}
26 }
27
28 void bar(id p);
29 void foo(id p) {
30 bar(@{p, p}); // expected-error {{expected ':'}}
31 bar(0);
32 bar(0);
33 }