[clang] [HLSL] Ignore complex types that do not contribute to cbuffer layout (PR #184276)
Helena Kotas via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 10 15:47:45 PDT 2026
================
@@ -568,15 +588,21 @@ void createHostLayoutStructForBuffer(Sema &S, HLSLBufferDecl *BufDecl) {
VD->getType().getAddressSpace() == LangAS::hlsl_groupshared)
continue;
const Type *Ty = VD->getType()->getUnqualifiedDesugaredType();
+
+ QualType NewTy;
if (FieldDecl *FD =
createFieldForHostLayoutStruct(S, Ty, VD->getIdentifier(), LS)) {
// add the field decl to the layout struct
LS->addDecl(FD);
// update address space of the original decl to hlsl_constant
- QualType NewTy =
- AST.getAddrSpaceQualType(VD->getType(), LangAS::hlsl_constant);
- VD->setType(NewTy);
+ NewTy = AST.getAddrSpaceQualType(VD->getType(), LangAS::hlsl_constant);
+ } else {
+ // Declarations in default cbuffer $Globals had the address space set to
----------------
hekota wrote:
I have updated the change to check for empty declarations in $Globals earlier.
https://github.com/llvm/llvm-project/pull/184276
More information about the cfe-commits
mailing list