================
@@ -3619,8 +3620,20 @@ llvm::GlobalVariable 
*ItaniumRTTIBuilder::GetAddrOfTypeName(
   // We know that the mangled name of the type starts at index 4 of the
   // mangled name of the typename, so we can just index into it in order to
   // get the mangled name of the type.
-  llvm::Constant *Init = llvm::ConstantDataArray::getString(VMContext,
-                                                            Name.substr(4));
+  llvm::Constant *Init;
+  if (CGM.getTriple().isOSzOS()) {
+    // On z/OS, typename is stored as 2 encodings: EBCDIC followed by ASCII.
+    SmallString<256> DualEncodedName;
+    llvm::ErrorOr<llvm::TextEncodingConverter> Converter =
+        llvm::TextEncodingConverter::create(
+            "UTF-8", CGM.getTriple().getDefaultNarrowTextEncoding());
----------------
tltao wrote:

Is the `getDefaultNarrowTextEncoding` function really needed? Seems like we 
check for `getTriple().isOSzOS()` in both places so couldn't this just be 
`"IBM-1047"`?

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

Reply via email to