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

Helena Kotas via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 7 11:31:55 PST 2025


================
@@ -393,7 +396,7 @@ static FieldDecl *createFieldForHostLayoutStruct(Sema &S, const Type *Ty,
   auto *Field = FieldDecl::Create(AST, LayoutStruct, SourceLocation(),
                                   SourceLocation(), II, QT, TSI, nullptr, false,
                                   InClassInitStyle::ICIS_NoInit);
-  Field->setAccess(AccessSpecifier::AS_private);
+  Field->setAccess(AccessSpecifier::AS_public);
----------------
hekota wrote:

It should be public so the layout struct can qualify as POD (plain old data), which affects the LLVM memory layout. It prevents LLVM from adding padding between the members or after the struct.

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


More information about the cfe-commits mailing list