[clang] [HLSL] Apply resource attributes to the resource type rather than the handle member (PR #107160)

Justin Bogner via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 4 12:42:39 PDT 2024


================
@@ -556,46 +562,120 @@ void SemaHLSL::handleShaderAttr(Decl *D, const ParsedAttr &AL) {
     D->addAttr(NewAttr);
 }
 
-void SemaHLSL::handleResourceClassAttr(Decl *D, const ParsedAttr &AL) {
-  if (!AL.isArgIdent(0)) {
-    Diag(AL.getLoc(), diag::err_attribute_argument_type)
-        << AL << AANT_ArgumentIdentifier;
-    return;
-  }
+bool clang::CreateHLSLAttributedResourceType(
+    Sema &S, QualType Wrapped, llvm::SmallVector<const Attr *> &AttrList,
----------------
bogner wrote:

We should be able to use an `ArrayRef<const Attr *> AttrList` instead of the SmallVector reference here since we just iterate over it. Note that if we did need the SmallVector API it would be better to use `SmallVectorImpl` instead since it doesn't encode a specific size.

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


More information about the cfe-commits mailing list