1 | // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -fdouble-square-bracket-attributes %s |
2 | |
3 | struct S {}; |
4 | struct S * [[clang::address_space(1)]] Foo; |
5 | |
6 | enum [[clang::enum_extensibility(open)]] EnumOpen { |
7 | C0 = 1, C1 = 10 |
8 | }; |
9 | |
10 | enum [[clang::flag_enum]] EnumFlag { |
11 | D0 = 1, D1 = 8 |
12 | }; |
13 | |
14 | void foo(void *c) [[clang::overloadable]]; |
15 | void foo(char *c) [[clang::overloadable]]; |
16 | |
17 | void context_okay(void *context [[clang::swift_context]]) [[clang::swiftcall]]; |
18 | void context_okay2(void *context [[clang::swift_context]], void *selfType, char **selfWitnessTable) [[clang::swiftcall]]; |
19 | |
20 | void *f1(void) [[clang::ownership_returns(foo)]]; |
21 | void *f2() [[clang::ownership_returns(foo)]]; // expected-warning {{'ownership_returns' attribute only applies to non-K&R-style functions}} |
22 | |
23 | void foo2(void) [[clang::unavailable("not available - replaced")]]; // expected-note {{'foo2' has been explicitly marked unavailable here}} |
24 | void bar(void) { |
25 | foo2(); // expected-error {{'foo2' is unavailable: not available - replaced}} |
26 | } |
27 | |