[clang] [HLSL] Make HLSLAttributedResourceType canonical and add code paths to convert HLSL types to DirectX target types (PR #110327)
Helena Kotas via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 10 08:22:37 PDT 2024
================
@@ -4493,28 +4493,34 @@ void CXXNameMangler::mangleType(const ArrayParameterType *T) {
}
void CXXNameMangler::mangleType(const HLSLAttributedResourceType *T) {
- mangleType(T->getWrappedType());
+ llvm::SmallString<64> Str("_Res");
const HLSLAttributedResourceType::Attributes &Attrs = T->getAttrs();
// map resource class to HLSL virtual register letter
switch (Attrs.ResourceClass) {
- case llvm::dxil::ResourceClass::UAV:
- Out << 'u';
+ case llvm::dxil::ResourceClass::UAV:
+ Str += "_u";
break;
- case llvm::dxil::ResourceClass::SRV:
- Out << 't';
+ case llvm::dxil::ResourceClass::SRV:
+ Str += "_t";
break;
case llvm::dxil::ResourceClass::CBuffer:
- Out << 'b';
+ Str += "_b";
break;
case llvm::dxil::ResourceClass::Sampler:
- Out << 's';
+ Str += "_s";
break;
}
- mangleNumber(Attrs.IsROV);
- mangleNumber(Attrs.RawBuffer);
+ mangleVendorQualifier(Str);
+ if (Attrs.IsROV)
+ mangleVendorQualifier("_ROV");
+ if (Attrs.RawBuffer)
+ mangleVendorQualifier("_Raw");
- if (!T->hasContainedType())
+ if (!T->hasContainedType()) {
+ mangleVendorQualifier("__CT");
----------------
hekota wrote:
Nope :) Thanks for the catch!
https://github.com/llvm/llvm-project/pull/110327
More information about the cfe-commits
mailing list