================
@@ -7386,12 +7376,24 @@ void Clang::ConstructJob(Compilation &C, const
JobAction &JA,
<< value;
}
- // -fexec_charset=UTF-8 is default. Reject others
- if (Arg *execCharset = Args.getLastArg(options::OPT_fexec_charset_EQ)) {
- StringRef value = execCharset->getValue();
- if (!value.equals_insensitive("utf-8"))
- D.Diag(diag::err_drv_invalid_value) << execCharset->getAsString(Args)
- << value;
+ if (Arg *execEncoding = Args.getLastArg(options::OPT_fexec_charset_EQ)) {
+ StringRef value = execEncoding->getValue();
+ bool KnownEncoding =
+ llvm::TextEncodingConverter::getKnownEncoding(value).has_value();
+ if (!KnownEncoding) {
+ llvm::ErrorOr<llvm::TextEncodingConverter> ErrorOrConverter =
+ llvm::TextEncodingConverter::create("UTF-8", value.data());
+ if (!ErrorOrConverter)
----------------
s-barannikov wrote:
> Should I move this logic into a IsEncodingSupported() function?
We also check if the conversion is table-based first (IIUC), and this looks
like an implementation detail. So yes, I think moving both these checks it into
a function like isEncodingSupported makes sense.
https://github.com/llvm/llvm-project/pull/138895
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits