================
@@ -5548,3 +5548,46 @@ bool SemaHLSL::handleInitialization(VarDecl *VDecl, Expr 
*&Init) {
   Init = C;
   return true;
 }
+
+QualType SemaHLSL::ActOnTemplateShorthand(TemplateDecl *Template,
+                                          SourceLocation NameLoc) {
+  if (!Template)
+    return QualType();
+
+  DeclContext *DC = Template->getDeclContext();
+  if (!DC->isNamespace() || !cast<NamespaceDecl>(DC)->getIdentifier() ||
+      cast<NamespaceDecl>(DC)->getName() != "hlsl")
+    return QualType();
+
+  TemplateParameterList *Params = Template->getTemplateParameters();
+  if (!Params || Params->size() != 1)
+    return QualType();
+
+  if (Template->getName() != "Texture2D")
+    return QualType();
----------------
s-perron wrote:

That seems to work. I also add test to make sure that [RW]Buffer and 
[RW]StructuredBuffer must have explicit templates.

https://github.com/llvm/llvm-project/pull/184207
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to