================
@@ -7987,10 +7987,25 @@ void Clang::ConstructJob(Compilation &C, const 
JobAction &JA,
   // -finput_charset=UTF-8 is default. Reject others
   if (Arg *inputCharset = Args.getLastArg(options::OPT_finput_charset_EQ)) {
     StringRef value = inputCharset->getValue();
-    if (!value.equals_insensitive("utf-8"))
+#if CLANG_DEFAULT_INPUT_ENCODING_IBM1047
+    // -finput_charset=IBM-1047 is default
+    bool isValid = value.equals_insensitive("ibm-1047");
+    CmdArgs.push_back("-finput-charset");
+    CmdArgs.push_back("IBM-1047");
+#else
+    bool isValid = value.equals_insensitive("utf-8");
+#endif
+    if (!isValid)
       D.Diag(diag::err_drv_invalid_value) << inputCharset->getAsString(Args)
                                           << value;
   }
+#if CLANG_DEFAULT_INPUT_ENCODING_IBM1047
+  else {
+    // No explicit -finput_charset provided, use default IBM-1047
+    CmdArgs.push_back("-finput-charset");
+    CmdArgs.push_back("IBM-1047");
+  }
+#endif
----------------
cor3ntin wrote:

This should go through normalizeCharSetName - `equals_insensitive` isn't 
reliable

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

Reply via email to