================
@@ -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
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to