[llvm-branch-commits] [clang] [HLSL] Constant buffers codegen (PR #124886)
Justin Bogner via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Feb 4 02:03:33 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)) {
----------------
bogner wrote:
This seems incredibly sketchy. Why is `LastDecl` appropriate here? What would it mean if `LastDecl` was removed from the `DeclarationContext` as the comment near it's definition says it may be? Is this just straight up relying on the order that the decls are created and hoping that that means it's the decl we're looking for?
https://github.com/llvm/llvm-project/pull/124886
More information about the llvm-branch-commits
mailing list