[llvm-branch-commits] [clang] [HLSL] Constant buffers codegen (PR #124886)
Helena Kotas via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Feb 4 13:30:39 PST 2025
================
@@ -5743,6 +5747,17 @@ HLSLBufferDecl *HLSLBufferDecl::CreateDeserialized(ASTContext &C,
SourceLocation(), SourceLocation());
}
+const CXXRecordDecl *HLSLBufferDecl::getLayoutStruct() const {
+ // Layout struct is the last decl in the HLSLBufferDecl.
+ if (CXXRecordDecl *RD = llvm::dyn_cast_or_null<CXXRecordDecl>(LastDecl)) {
----------------
hekota wrote:
My thoughts were that since we are creating the layout struct, we can guarantee it is going to be the last one in the `HLSLBufferDecl` context, and there is an assert verifying that. I used `LastDecl` to avoid adding additional member to `HLSLBufferDecl` and it seemed to be a safe option (the FIXME comment is 17 years old). I will add an explicit field for the layout struct to make it cleaner.
https://github.com/llvm/llvm-project/pull/124886
More information about the llvm-branch-commits
mailing list