[clang] [HLSL] Make HLSLAttributedResourceType canonical and add code paths to convert HLSL types to DirectX target types (PR #110327)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 30 12:38:53 PDT 2024


================
@@ -3753,6 +3754,32 @@ void MicrosoftCXXNameMangler::mangleType(const DependentBitIntType *T,
   Error(Range.getBegin(), "DependentBitInt type") << Range;
 }
 
+void MicrosoftCXXNameMangler::mangleType(const HLSLAttributedResourceType *T,
+                                         Qualifiers, SourceRange Range) {
+  mangleType(T->getWrappedType(), SourceRange(), QMM_Escape);
+  const HLSLAttributedResourceType::Attributes &Attrs = T->getAttrs();
+  // map resource class to HLSL virtual register letter
+  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 << 'b';
+    break;
+  case llvm::dxil::ResourceClass::Sampler:
+    Out << 's';
+    break;
+  }
----------------
llvm-beanz wrote:

The MSVC ABI doesn't have a vendor-specific qualifier. We should probably try to confer with the MSVC team about how to handle mangling these so that we don't interfere with MSVC ABI support.

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


More information about the cfe-commits mailing list