[Clang/AMDGPU] Zero sized arrays not allowed in HIP device code. (#113470)
[llvm-project.git] / clang / test / Index / attributes-cuda.cu
blob83ac8d389fe6e9df323e48e3d93f31168e1ce776
1 // RUN: c-index-test -test-load-source all -x cuda %s | FileCheck %s
2 // RUN: c-index-test -test-load-source all -x cuda --cuda-host-only %s | FileCheck %s
3 // RUN: c-index-test -test-load-source all -x cuda --cuda-device-only %s | FileCheck %s
5 __attribute__((device)) void f_device();
6 __attribute__((global)) void f_global();
7 __attribute__((constant)) int* g_constant;
8 __attribute__((shared)) float *g_shared;
9 __attribute__((host)) void f_host();
10 __attribute__((device_builtin)) void f_device_builtin();
11 typedef __attribute__((device_builtin)) const void *t_device_builtin;
12 enum __attribute__((device_builtin)) e_device_builtin {};
13 __attribute__((device_builtin)) int v_device_builtin;
14 __attribute__((cudart_builtin)) void f_cudart_builtin();
15 __attribute__((nv_weak)) void f_nv_weak();
16 __attribute__((device_builtin_surface_type)) unsigned long long surface_var;
17 __attribute__((device_builtin_texture_type)) unsigned long long texture_var;
19 // CHECK:       attributes-cuda.cu:5:30: FunctionDecl=f_device:5:30
20 // CHECK-NEXT:  attributes-cuda.cu:5:16: attribute(device)
21 // CHECK:       attributes-cuda.cu:6:30: FunctionDecl=f_global:6:30
22 // CHECK-NEXT:  attributes-cuda.cu:6:16: attribute(global)
23 // CHECK:       attributes-cuda.cu:7:32: VarDecl=g_constant:7:32 (Definition)
24 // CHECK-NEXT:  attributes-cuda.cu:7:16: attribute(constant)
25 // CHECK:       attributes-cuda.cu:8:32: VarDecl=g_shared:8:32 (Definition)
26 // CHECK-NEXT:  attributes-cuda.cu:8:16: attribute(shared)
27 // CHECK:       attributes-cuda.cu:9:28: FunctionDecl=f_host:9:28
28 // CHECK-NEXT:  attributes-cuda.cu:9:16: attribute(host)
29 // CHECK:       attributes-cuda.cu:10:38: FunctionDecl=f_device_builtin:10:38
30 // CHECK:       attributes-cuda.cu:11:53: TypedefDecl=t_device_builtin:11:53
31 // CHECK:       attributes-cuda.cu:12:38: EnumDecl=e_device_builtin:12:38
32 // CHECK:       attributes-cuda.cu:13:37: VarDecl=v_device_builtin:13:37
33 // CHECK:       attributes-cuda.cu:14:38: FunctionDecl=f_cudart_builtin:14:38
34 // CHECK:       attributes-cuda.cu:15:31: FunctionDecl=f_nv_weak:15:31
35 // CHECK:       attributes-cuda.cu:16:65: VarDecl=surface_var:16:65
36 // CHECK:       attributes-cuda.cu:17:65: VarDecl=texture_var:17:65