[clang] [HLSL] Split out the ROV attribute from the resource attribute, make it a new spellable attribute. (PR #102414)

Justin Bogner via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 12 07:09:09 PDT 2024


================
@@ -296,12 +296,13 @@ void CGHLSLRuntime::annotateHLSLResource(const VarDecl *D, GlobalVariable *GV) {
   for (auto *FD : RD->fields()) {
     const auto *HLSLResAttr = FD->getAttr<HLSLResourceAttr>();
     const auto *HLSLResClassAttr = FD->getAttr<HLSLResourceClassAttr>();
+    const auto *ROVAttr = FD->getAttr<HLSLROVAttr>();
     if (!HLSLResAttr || !HLSLResClassAttr)
       continue;
 
     llvm::hlsl::ResourceClass RC = HLSLResClassAttr->getResourceClass();
     llvm::hlsl::ResourceKind RK = HLSLResAttr->getResourceKind();
-    bool IsROV = HLSLResAttr->getIsROV();
+    bool IsROV = FD->getAttr<HLSLROVAttr>() ? true : false;
----------------
bogner wrote:

I think there’s a “FD->hasAttr” you can use to simplify this slightly

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


More information about the cfe-commits mailing list