[clang] [HLSL] Add `[[hlsl::contained_type()]]` attribute (PR #108456)

Helena Kotas via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 12 20:29:37 PDT 2024


================
@@ -563,18 +566,23 @@ void SemaHLSL::handleShaderAttr(Decl *D, const ParsedAttr &AL) {
     D->addAttr(NewAttr);
 }
 
-bool clang::CreateHLSLAttributedResourceType(Sema &S, QualType Wrapped,
-                                             ArrayRef<const Attr *> AttrList,
-                                             QualType &ResType) {
+bool clang::CreateHLSLAttributedResourceType(
+    Sema &S, QualType Wrapped, ArrayRef<const Attr *> AttrList,
+    QualType &ResType, HLSLAttributedResourceLocInfo *LocInfo /*= nullptr*/) {
   assert(AttrList.size() && "expected list of resource attributes");
 
-  QualType Contained = QualType();
+  QualType ContainedTy = QualType();
+  TypeSourceInfo *ContainedTyTSI;
+  SourceLocation LocBegin = AttrList[0]->getRange().getBegin();
+  SourceLocation LocEnd = SourceLocation();
----------------
hekota wrote:

Sure. It will get overridden when a first non-null attribute is processed, and it is guaranteed at least one attribute is going to be non-null (resource_class) or no attributed type gets created, but yes, it is cleaner to initialize it to the end position of the first attribute.

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


More information about the cfe-commits mailing list