Clang Project

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