[clang] [HLSL] Constant buffer layout struct update (PR #124840)

Joshua Batista via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 7 11:20:32 PST 2025


================
@@ -472,14 +477,16 @@ void createHostLayoutStructForBuffer(Sema &S, HLSLBufferDecl *BufDecl) {
   IdentifierInfo *II = getHostLayoutStructName(S, BufDecl, true);
 
   CXXRecordDecl *LS =
-      CXXRecordDecl::Create(AST, TagDecl::TagKind::Class, BufDecl,
+      CXXRecordDecl::Create(AST, TagDecl::TagKind::Struct, BufDecl,
                             SourceLocation(), SourceLocation(), II);
+  LS->addAttr(PackedAttr::CreateImplicit(AST));
   LS->setImplicit(true);
   LS->startDefinition();
 
   for (Decl *D : BufDecl->decls()) {
     VarDecl *VD = dyn_cast<VarDecl>(D);
-    if (!VD || VD->getStorageClass() == SC_Static)
+    if (!VD || VD->getStorageClass() == SC_Static ||
+        VD->getType().getAddressSpace() == LangAS::hlsl_groupshared)
----------------
bob80905 wrote:

Looks like you're filtering out groupshared VarDecls. Can you add that to the list of filters in the comment above?
Also, can you edit the typo "The layour" ?

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


More information about the cfe-commits mailing list