r279866 - clang-cl: Accept MSVC 2015's `/execution-charset:utf-8` flag.
Nico Weber via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 26 14:11:43 PDT 2016
Author: nico
Date: Fri Aug 26 16:11:43 2016
New Revision: 279866
URL: http://llvm.org/viewvc/llvm-project?rev=279866&view=rev
Log:
clang-cl: Accept MSVC 2015's `/execution-charset:utf-8` flag.
Also makes -fexec-charset accept utf-8 case-insensitively.
Like https://reviews.llvm.org/D23807, but for execution-charset.
Also replace a few .lower() comparisons with equals_lower().
https://reviews.llvm.org/D23938
Modified:
cfe/trunk/include/clang/Driver/CLCompatOptions.td
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/cl-options.c
Modified: cfe/trunk/include/clang/Driver/CLCompatOptions.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CLCompatOptions.td?rev=279866&r1=279865&r2=279866&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/CLCompatOptions.td (original)
+++ cfe/trunk/include/clang/Driver/CLCompatOptions.td Fri Aug 26 16:11:43 2016
@@ -122,6 +122,8 @@ def _SLASH_showIncludes : CLFlag<"showIn
Alias<show_includes>;
def _SLASH_source_charset : CLCompileJoined<"source-charset:">,
HelpText<"Source encoding, supports only UTF-8">, Alias<finput_charset_EQ>;
+def _SLASH_execution_charset : CLCompileJoined<"execution-charset:">,
+ HelpText<"Runtime encoding, supports only UTF-8">, Alias<fexec_charset_EQ>;
def _SLASH_std : CLCompileJoined<"std:">,
HelpText<"Language standard to compile for">;
def _SLASH_U : CLJoinedOrSeparate<"U">, HelpText<"Undefine macro">,
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=279866&r1=279865&r2=279866&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Aug 26 16:11:43 2016
@@ -5835,7 +5835,7 @@ void Clang::ConstructJob(Compilation &C,
// -finput_charset=UTF-8 is default. Reject others
if (Arg *inputCharset = Args.getLastArg(options::OPT_finput_charset_EQ)) {
StringRef value = inputCharset->getValue();
- if (value.lower() != "utf-8")
+ if (!value.equals_lower("utf-8"))
D.Diag(diag::err_drv_invalid_value) << inputCharset->getAsString(Args)
<< value;
}
@@ -5843,7 +5843,7 @@ void Clang::ConstructJob(Compilation &C,
// -fexec_charset=UTF-8 is default. Reject others
if (Arg *execCharset = Args.getLastArg(options::OPT_fexec_charset_EQ)) {
StringRef value = execCharset->getValue();
- if (value != "UTF-8")
+ if (!value.equals_lower("utf-8"))
D.Diag(diag::err_drv_invalid_value) << execCharset->getAsString(Args)
<< value;
}
@@ -9219,7 +9219,7 @@ void gnutools::Assembler::ConstructJob(C
// march from being picked in the absence of a cpu flag.
Arg *A;
if ((A = Args.getLastArg(options::OPT_mcpu_EQ)) &&
- StringRef(A->getValue()).lower() == "krait")
+ StringRef(A->getValue()).equals_lower("krait"))
CmdArgs.push_back("-mcpu=cortex-a15");
else
Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
Modified: cfe/trunk/test/Driver/cl-options.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=279866&r1=279865&r2=279866&view=diff
==============================================================================
--- cfe/trunk/test/Driver/cl-options.c (original)
+++ cfe/trunk/test/Driver/cl-options.c Fri Aug 26 16:11:43 2016
@@ -184,6 +184,10 @@
// RUN: %clang_cl /source-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=source-charset-utf-16 %s
// source-charset-utf-16: invalid value 'utf-16'
+// /execution-charset: should warn on everything except UTF-8.
+// RUN: %clang_cl /execution-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=execution-charset-utf-16 %s
+// execution-charset-utf-16: invalid value 'utf-16'
+//
// RUN: %clang_cl /Umymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
// RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
// U: "-U" "mymacro"
@@ -289,6 +293,7 @@
// RUN: /d2FastFail \
// RUN: /d2Zi+ \
// RUN: /errorReport:foo \
+// RUN: /execution-charset:utf-8 \
// RUN: /FC \
// RUN: /Fdfoo \
// RUN: /FS \
More information about the cfe-commits
mailing list