[clang] Attach resource attributes to handle within record, instead of record (PR #101433)

Damyan Pepper via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 1 15:02:04 PDT 2024


================
@@ -280,18 +280,22 @@ void CGHLSLRuntime::annotateHLSLResource(const VarDecl *D, GlobalVariable *GV) {
   const auto *RD = Ty->getAsCXXRecordDecl();
   if (!RD)
     return;
-  const auto *HLSLResAttr = RD->getAttr<HLSLResourceAttr>();
-  const auto *HLSLResClassAttr = RD->getAttr<HLSLResourceClassAttr>();
-  if (!HLSLResAttr || !HLSLResClassAttr)
-    return;
+  // the resource related attributes are on the handle member
----------------
damyanp wrote:

I'm not sure if this is too remedial, but for someone with my limited experience a comment along the lines of "If this variable's type is actually an HLSL resource then annotate it appropriately" would have helped me greatly in understanding it.

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


More information about the cfe-commits mailing list