[clang] [HLSL] Add globals for resources embedded in structs (PR #184281)

via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 10 18:29:14 PDT 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Windows-->
# :window: Windows x64 Test Results

* 53158 tests passed
* 1018 tests skipped
* 1 test failed

## Failed Tests
(click on a test name to see its output)

### Clang
<details>
<summary>Clang.AST/HLSL/resources-in-structs.hlsl</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
c:\_work\llvm-project\llvm-project\build\bin\clang.exe -cc1 -internal-isystem C:\_work\llvm-project\llvm-project\build\lib\clang\23\include -nostdsysteminc -triple dxil-pc-shadermodel6.0-compute -ast-dump C:\_work\llvm-project\llvm-project\clang\test\AST\HLSL\resources-in-structs.hlsl | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\clang\test\AST\HLSL\resources-in-structs.hlsl
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\clang.exe' -cc1 -internal-isystem 'C:\_work\llvm-project\llvm-project\build\lib\clang\23\include' -nostdsysteminc -triple dxil-pc-shadermodel6.0-compute -ast-dump 'C:\_work\llvm-project\llvm-project\clang\test\AST\HLSL\resources-in-structs.hlsl'
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\clang\test\AST\HLSL\resources-in-structs.hlsl'
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\clang\test\AST\HLSL\resources-in-structs.hlsl:14:11: error: CHECK: expected string not found in input
# | // CHECK: VarDecl {{.*}} a1 'hlsl_constant A'
# |           ^
# | <stdin>:944:75: note: scanning from here
# | | `-HLSLResourceBindingAttr 0x1646e6ca4b0 <<invalid sloc>> Implicit "" "0"
# |                                                                           ^
# | <stdin>:961:33: note: possible intended match here
# | | | `-ParmVarDecl 0x1646e6c79e0 <col:8> col:8 'const B &'
# |                                 ^
# | 
# | Input file: <stdin>
# | Check file: C:\_work\llvm-project\llvm-project\clang\test\AST\HLSL\resources-in-structs.hlsl
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |           939: | | |-IntegerLiteral 0x1646e6ca580 <<invalid sloc>> 'unsigned int' 0 
# |           940: | | |-IntegerLiteral 0x1646e6ca5a8 <<invalid sloc>> 'int' 1 
# |           941: | | |-IntegerLiteral 0x1646e6ca5d0 <<invalid sloc>> 'unsigned int' 0 
# |           942: | | `-ImplicitCastExpr 0x1646e6ca6a0 <<invalid sloc>> 'const char *' <ArrayToPointerDecay> 
# |           943: | | `-StringLiteral 0x1646e6ca680 <<invalid sloc>> 'const char[7]' lvalue "a1.Buf" 
# |           944: | `-HLSLResourceBindingAttr 0x1646e6ca4b0 <<invalid sloc>> Implicit "" "0" 
# | check:14'0                                                                               X error: no match found
# |           945: |-VarDecl 0x1646e6ca338 <line:17:1, col:3> col:3 used a1 'A' callinit 
# | check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           946: | |-CXXConstructExpr 0x1646e6cc740 <col:3> 'A' 'void () noexcept(false)' 
# | check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           947: | |-HLSLResourceBindingAttr 0x1646e6ca3a0 <col:8> "u0" "space0" 
# | check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           948: | `-HLSLAssociatedResourceDeclAttr 0x1646e6cc3d8 <<invalid sloc>> Implicit Var 0x1646e6ca448 'a1.Buf' 'hlsl::RWBuffer<float>' 
# | check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           949: |-CXXRecordDecl 0x1646e6cc7c8 <line:23:1, line:25:1> line:23:8 referenced struct B definition 
# | check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             .
# |             .
# |             .
# |           956: | | `-Destructor simple irrelevant trivial needs_implicit 
# | check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           957: | |-PackedAttr 0x1646e6cc870 <<invalid sloc>> Implicit 
# | check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           958: | |-CXXRecordDecl 0x1646e6cc938 <col:1, col:8> col:8 implicit struct B 
# | check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           959: | |-FieldDecl 0x1646e6ccb80 <line:24:3, col:26> col:19 Bufs 'RWBuffer<float>[10]' 
# | check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           960: | |-CXXConstructorDecl 0x1646e6c78a8 <line:23:8> col:8 implicit B 'void (const B &)' inline default noexcept-unevaluated 0x1646e6c78a8 
# | check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           961: | | `-ParmVarDecl 0x1646e6c79e0 <col:8> col:8 'const B &' 
# | check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:14'1                                     ?                          possible intended match
# |           962: | |-CXXConstructorDecl 0x1646e6c7ac0 <col:8> col:8 implicit B 'void (B &&)' inline default noexcept-unevaluated 0x1646e6c7ac0 
# | check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           963: | | `-ParmVarDecl 0x1646e6c7bf0 <col:8> col:8 'B &&' 
# | check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           964: | |-CXXMethodDecl 0x1646e6c7ce0 <col:8> col:8 implicit operator= 'B &(const B &)' inline default noexcept-unevaluated 0x1646e6c7ce0 
# | check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           965: | | `-ParmVarDecl 0x1646e6c7e10 <col:8> col:8 'const B &' 
# | check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           966: | |-CXXMethodDecl 0x1646e6c7e88 <col:8> col:8 implicit operator= 'B &(B &&)' inline default noexcept-unevaluated 0x1646e6c7e88 
# | check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

https://github.com/llvm/llvm-project/pull/184281


More information about the cfe-commits mailing list