[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
Mon Sep 30 12:35:26 PDT 2024
================
@@ -4488,6 +4488,30 @@ void CXXNameMangler::mangleType(const ArrayParameterType *T) {
mangleType(cast<ConstantArrayType>(T));
}
+void CXXNameMangler::mangleType(const HLSLAttributedResourceType *T) {
+ mangleType(T->getWrappedType());
+ const HLSLAttributedResourceType::Attributes &Attrs = T->getAttrs();
+ switch (Attrs.ResourceClass) {
+ case llvm::dxil::ResourceClass::UAV:
+ Out << 'U';
+ break;
+ case llvm::dxil::ResourceClass::SRV:
+ Out << 'T';
+ break;
+ case llvm::dxil::ResourceClass::CBuffer:
+ Out << 'C';
+ break;
+ case llvm::dxil::ResourceClass::Sampler:
+ Out << 'S';
+ break;
+ }
----------------
hekota wrote:
This is intentional. If add a default case, there'll be a warning `Default label in switch which covers all enumeration values`. If a new value is added to ResourceClass, there'll be a warning that this switch does not cover all enum values.
https://github.com/llvm/llvm-project/pull/110327
More information about the cfe-commits
mailing list