Files
TheRock/compiler/amd-llvm/clang/test/AST/HLSL/cbuffer_and_namespaces.hlsl
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

97 lines
3.0 KiB
HLSL

// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -ast-dump -o - %s | FileCheck %s
// CHECK: CXXRecordDecl {{.*}} struct EmptyStruct definition
struct EmptyStruct {
};
// CHECK: NamespaceDecl {{.*}} NS1
namespace NS1 {
// CHECK: CXXRecordDecl {{.*}} struct Foo definition
struct Foo {
float a;
EmptyStruct es;
};
// CHECK: CXXRecordDecl {{.*}} struct Bar definition
struct Bar {
// CHECK: CXXRecordDecl {{.*}} struct Foo definition
struct Foo {
int b;
EmptyStruct es;
};
// CHECK: CXXRecordDecl {{.*}} implicit struct __cblayout_Foo definition
// CHECK: FieldDecl {{.*}} b 'int'
};
// CHECK: CXXRecordDecl {{.*}} implicit struct __cblayout_Foo definition
// CHECK: FieldDecl {{.*}} a 'float'
}
struct Foo {
double c;
EmptyStruct es;
};
// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 2]]:9 cbuffer CB1
// CHECK: HLSLResourceClassAttr {{.*}} Implicit CBuffer
cbuffer CB1 {
// CHECK: VarDecl {{.*}} foo1 'hlsl_constant Foo'
Foo foo1;
// CHECK: VarDecl {{.*}} foo2 'hlsl_constant NS1::Foo'
NS1::Foo foo2;
// CHECK: VarDecl {{.*}} foo3 'hlsl_constant NS1::Bar::Foo'
NS1::Bar::Foo foo3;
// CHECK: CXXRecordDecl {{.*}} implicit referenced struct __cblayout_CB1 definition
// CHECK: FieldDecl {{.*}} foo1 '__cblayout_Foo'
// CHECK: FieldDecl {{.*}} foo2 'NS1::__cblayout_Foo'
// CHECK: FieldDecl {{.*}} foo3 'NS1::Bar::__cblayout_Foo'
}
// CHECK: CXXRecordDecl {{.*}} implicit struct __cblayout_Foo definition
// CHECK: FieldDecl {{.*}} c 'double'
struct CB1ExpectedShape {
double a1;
float a2;
int a;
};
_Static_assert(__builtin_hlsl_is_scalarized_layout_compatible(CB1ExpectedShape, __cblayout_CB1), "");
namespace NS2 {
struct Foo {
float d[4];
EmptyStruct es;
};
// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 2]]:11 cbuffer CB2
// CHECK: HLSLResourceClassAttr {{.*}} Implicit CBuffer
cbuffer CB2 {
// CHECK: VarDecl {{.*}} foo0 'hlsl_constant ::Foo'
::Foo foo0;
// CHECK: VarDecl {{.*}} foo1 'hlsl_constant Foo'
Foo foo1;
// CHECK: VarDecl {{.*}} foo2 'hlsl_constant NS1::Foo'
NS1::Foo foo2;
// CHECK: VarDecl {{.*}} foo3 'hlsl_constant NS1::Bar::Foo'
NS1::Bar::Foo foo3;
// CHECK: CXXRecordDecl {{.*}} implicit referenced struct __cblayout_CB2 definition
// CHECK: FieldDecl {{.*}} foo0 '__cblayout_Foo'
// CHECK: FieldDecl {{.*}} foo1 'NS2::__cblayout_Foo'
// CHECK: FieldDecl {{.*}} foo2 'NS1::__cblayout_Foo'
// CHECK: FieldDecl {{.*}} foo3 'NS1::Bar::__cblayout_Foo'
}
// CHECK: CXXRecordDecl {{.*}} implicit struct __cblayout_Foo definition
// CHECK: FieldDecl {{.*}} d 'float[4]'
}
struct CB2ExpectedShape {
double a1;
float d[4];
float a2;
int a;
};
_Static_assert(__builtin_hlsl_is_scalarized_layout_compatible(CB2ExpectedShape, NS2::__cblayout_CB2), "");
// Add uses for the constant buffer declarations so they are not optimized away
// CHECK: ExportDecl
export float f() {
return foo2.a + NS2::foo2.a;
}