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

Justin Bogner via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 12 14:50:56 PDT 2024


================
@@ -114,19 +115,30 @@ struct BuiltinTypeDeclBuilder {
                   AccessSpecifier Access = AccessSpecifier::AS_private) {
     if (Record->isCompleteDefinition())
       return *this;
+
+    TypeSourceInfo *ElementTypeTSI = nullptr;
+
     QualType Ty = Record->getASTContext().VoidPtrTy;
     if (Template) {
-      if (const auto *TTD = dyn_cast<TemplateTypeParmDecl>(
-              Template->getTemplateParameters()->getParam(0)))
+      if (const TemplateTypeParmDecl *TTD = dyn_cast<TemplateTypeParmDecl>(
+              Template->getTemplateParameters()->getParam(0))) {
         Ty = Record->getASTContext().getPointerType(
             QualType(TTD->getTypeForDecl(), 0));
+        QualType ElemType = QualType(TTD->getTypeForDecl(), 0);
+        ElementTypeTSI = S.getASTContext().getTrivialTypeSourceInfo(
+            ElemType, SourceLocation());
----------------
bogner wrote:

Is this an empty source location? Can we not get something better here?

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


More information about the cfe-commits mailing list