[clang] [HLSL] Implement `SpirvType` and `SpirvOpaqueType` (PR #134034)
Steven Perron via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 25 11:03:29 PDT 2025
================
@@ -4855,6 +4857,17 @@ LinkageInfo LinkageComputer::computeTypeLinkageInfo(const Type *T) {
return computeTypeLinkageInfo(cast<HLSLAttributedResourceType>(T)
->getContainedType()
->getCanonicalTypeInternal());
+ case Type::HLSLInlineSpirv:
+ return LinkageInfo::external();
+ {
----------------
s-perron wrote:
I don't know if we can have different linkages on types in HLSL. You cannot put a type in the anonymous namespace. You can't use `__attribute__((internal_linkage))`. I'm not sure how we would test this properly.
In the HLSL source, this is a type with a templates that build the type. Change the template parameters, change the type. I don't know if this causes it to be classified as a dependent type, and should always return `external` as is done for all dependent types. If that is true, then we should label this as a dependent type in TypeNodes.td.
The argument for the removing the return is that if one of the templates is say an internal type, then the vk::SpirvType should be internal too, as is done for functions with a parameter type that is internal. As I said before, we would not be able to test this.
@llvm-beanz @AaronBallman Let me know if you know the right way to do this.
FYI: Cassie is no longer working on this. I'll see if I can fix it up.
https://github.com/llvm/llvm-project/pull/134034
More information about the cfe-commits
mailing list