[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Parser / attr-external-source-symbol.m
blob752c748be84a75b2b3d4e7e83fe27fc6a880df78
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 void function(void) __attribute__((external_source_symbol(language="Swift", defined_in="module", generated_declaration)));
5 __attribute__((external_source_symbol(language="Swift", defined_in="module")))
6 @interface I
8 - (void)method __attribute__((external_source_symbol(defined_in= "module")));
10 @end
12 enum E {
13   CaseA __attribute__((external_source_symbol(generated_declaration))),
14   CaseB __attribute__((external_source_symbol(generated_declaration, language="Swift")))
15 } __attribute__((external_source_symbol(language = "Swift")));
17 void f2(void)
18 __attribute__((external_source_symbol())); // expected-error {{expected 'language', 'defined_in', or 'generated_declaration'}}
19 void f3(void)
20 __attribute__((external_source_symbol(invalid))); // expected-error {{expected 'language', 'defined_in', or 'generated_declaration'}}
21 void f4(void)
22 __attribute__((external_source_symbol(language))); // expected-error {{expected '=' after language}}
23 void f5(void)
24 __attribute__((external_source_symbol(language=))); // expected-error {{expected string literal for language name in 'external_source_symbol' attribute}}
25 void f6(void)
26 __attribute__((external_source_symbol(defined_in=20))); // expected-error {{expected string literal for source container name in 'external_source_symbol' attribute}}
28 void f7(void)
29 __attribute__((external_source_symbol(generated_declaration, generated_declaration))); // expected-error {{duplicate 'generated_declaration' clause in an 'external_source_symbol' attribute}}
30 void f8(void)
31 __attribute__((external_source_symbol(language="Swift", language="Swift"))); // expected-error {{duplicate 'language' clause in an 'external_source_symbol' attribute}}
32 void f9(void)
33 __attribute__((external_source_symbol(defined_in="module", language="Swift", defined_in="foo"))); // expected-error {{duplicate 'defined_in' clause in an 'external_source_symbol' attribute}}
35 void f10(void)
36 __attribute__((external_source_symbol(generated_declaration, language="Swift", defined_in="foo", generated_declaration, generated_declaration, language="Swift"))); // expected-error {{duplicate 'generated_declaration' clause in an 'external_source_symbol' attribute}}
38 void f11(void)
39 __attribute__((external_source_symbol(language="Objective-C++", defined_in="Some file with spaces")));
41 void f12(void)
42 __attribute__((external_source_symbol(language="C Sharp", defined_in="file:////Hello world with spaces. cs")));
44 void f13(void)
45 __attribute__((external_source_symbol(language=Swift))); // expected-error {{expected string literal for language name in 'external_source_symbol' attribute}}
47 void f14(void)
48 __attribute__((external_source_symbol(=))); // expected-error {{expected 'language', 'defined_in', or 'generated_declaration'}}
50 void f15(void)
51 __attribute__((external_source_symbol(="Swift"))); // expected-error {{expected 'language', 'defined_in', or 'generated_declaration'}}
53 void f16(void)
54 __attribute__((external_source_symbol("Swift", "module", generated_declaration))); // expected-error {{expected 'language', 'defined_in', or 'generated_declaration'}}
56 void f17(void)
57 __attribute__((external_source_symbol(language="Swift", "generated_declaration"))); // expected-error {{expected 'language', 'defined_in', or 'generated_declaration'}}
59 void f18(void)
60 __attribute__((external_source_symbol(language= =))); // expected-error {{expected string literal for language name in 'external_source_symbol' attribute}}
62 void f19(void)
63 __attribute__((external_source_symbol(defined_in="module" language="swift"))); // expected-error {{expected ')'}} expected-note {{to match this '('}}
65 void f20(void)
66 __attribute__((external_source_symbol(defined_in="module" language="swift" generated_declaration))); // expected-error {{expected ')'}} expected-note {{to match this '('}}
68 void f21(void)
69 __attribute__((external_source_symbol(defined_in= language="swift"))); // expected-error {{expected string literal for source container name in 'external_source_symbol' attribute}}
71 void f22(void)
72 __attribute__((external_source_symbol)); // expected-error {{'external_source_symbol' attribute takes at least 1 argument}}
74 void f23(void)
75 __attribute__((external_source_symbol(defined_in=, language="swift" generated_declaration))); // expected-error {{expected string literal for source container name in 'external_source_symbol' attribute}} expected-error{{expected ')'}} expected-note{{to match this '('}}
77 void f24(void)
78 __attribute__((external_source_symbol(language = generated_declaration))); // expected-error {{expected string literal for language name in 'external_source_symbol' attribute}}
80 void f25(void)
81 __attribute__((external_source_symbol(defined_in=123, defined_in="module"))); // expected-error {{expected string literal for source container name in 'external_source_symbol'}} expected-error {{duplicate 'defined_in' clause in an 'external_source_symbol' attribute}}
83 void f26(void)
84 __attribute__((external_source_symbol(language=Swift, language="Swift", error))); // expected-error {{expected string literal for language name in 'external_source_symbol'}} expected-error {{duplicate 'language' clause in an 'external_source_symbol' attribute}} expected-error {{expected 'language', 'defined_in', or 'generated_declaration'}}