Debian Codegraph @

clang/test/SemaHLSL/export.hlsl

raw
1 // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - %s -verify
2
3 export void f1();
4
5 export void f1() {}
6
7 namespace { // expected-note {{anonymous namespace begins here}}
8 export void f2(); // expected-error {{export declaration appears within anonymous namespace}}
9 }
10
11 export void f3();
12
13 export { // expected-note {{export block begins here}}
14 void f4() {}
15 export void f5() {} // expected-error {{export declaration appears within another export declaration}}
16 int A; // expected-error {{export declaration can only be used on functions}}
17 namespace ns { // expected-error {{export declaration can only be used on functions}}
18 void f6();
19 }
20 }
21
22 export { // expected-note {{export block begins here}}
23 export { // expected-error {{export declaration appears within another export declaration}}
24 void f();
25 }
26 }
27
28 void export f7() {} // expected-error {{expected unqualified-id}}
29
30 export static void f8() {} // expected-error {{declaration of 'f8' with internal linkage cannot be exported}}
31
32 export void f9(); // expected-note {{previous declaration is here}}
33 static void f9(); // expected-error {{static declaration of 'f9' follows non-static declaration}}
34
35 static void f10(); // expected-note {{previous declaration is here}}
36 export void f10(); // expected-error {{cannot export redeclaration 'f10' here since the previous declaration has internal linkage}}
37
38 export void f11();
39 void f11() {}
40
41 void f12(); // expected-note{{previous declaration is here}}
42 export void f12() {} // expected-error{{cannot export redeclaration 'f12' here since the previous declaration is not exported}}
43
44 export float V1; // expected-error {{export declaration can only be used on functions}}
45
46 static export float V2; // expected-error{{expected unqualified-id}}
47
48 export static float V3 = 0; // expected-error {{export declaration can only be used on functions}}
49
50 export groupshared float V4; // expected-error {{export declaration can only be used on functions}}
51
52 void f6() {
53 export int i; // expected-error {{expected expression}}
54 }
55
56 export cbuffer CB { // expected-error {{export declaration can only be used on functions}}
57 int a;
58 }
59
60 export template<typename T> void tf1(T t) {} // expected-error {{export declaration can only be used on functions}}
61
62 void f5() export {} // expected-error {{expected function body after function declarator}}