================
@@ -3621,15 +3621,24 @@ llvm::GlobalVariable 
*ItaniumRTTIBuilder::GetAddrOfTypeName(
   // 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;
+
+  SmallString<256> ConvertedName;
+  llvm::ErrorOr<llvm::TextEncodingConverter> Converter =
+      llvm::TextEncodingConverter::create(
+          "UTF-8", CGM.getTriple().getDefaultNarrowTextEncoding());
+  if (Converter)
+    Converter->convert(Name.substr(4), ConvertedName);
+  else
+    ConvertedName = Name.substr(4);
+
   if (CGM.getTriple().isOSzOS()) {
     // On z/OS, typename is stored as 2 encodings: EBCDIC followed by ASCII.
-    SmallString<256> DualEncodedName;
-    llvm::ConverterEBCDIC::convertToEBCDIC(Name.substr(4), DualEncodedName);
+    SmallString<256> DualEncodedName = ConvertedName;
     DualEncodedName += '\0';
     DualEncodedName += Name.substr(4);
     Init = llvm::ConstantDataArray::getString(VMContext, DualEncodedName);
   } else
-    Init = llvm::ConstantDataArray::getString(VMContext, Name.substr(4));
+    Init = llvm::ConstantDataArray::getString(VMContext, ConvertedName);
----------------
abhina-sree wrote:

I actually made this change in another PR 
https://github.com/llvm/llvm-project/pull/179687 and limited it to z/OS, I will 
remove it from this PR

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

Reply via email to