Re: [PATCH] D23938: clang-cl: Accept MSVC 2015's `/execution-charset:utf-8` flag.

2016-08-26 Thread Nico Weber via cfe-commits
thakis closed this revision.
thakis marked an inline comment as done.
thakis added a comment.

r279866, thanks!


https://reviews.llvm.org/D23938



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23938: clang-cl: Accept MSVC 2015's `/execution-charset:utf-8` flag.

2016-08-26 Thread Hans Wennborg via cfe-commits
hans accepted this revision.
hans added a comment.
This revision is now accepted and ready to land.

lgtm

majnemer's suggestion sounds good though, and for inputCharset too.


https://reviews.llvm.org/D23938



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23938: clang-cl: Accept MSVC 2015's `/execution-charset:utf-8` flag.

2016-08-26 Thread David Majnemer via cfe-commits
majnemer added a subscriber: majnemer.


Comment at: lib/Driver/Tools.cpp:5838-5846
@@ -5837,11 +5837,11 @@
 StringRef value = inputCharset->getValue();
 if (value.lower() != "utf-8")
   D.Diag(diag::err_drv_invalid_value) << inputCharset->getAsString(Args)
   << 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 != "UTF-8")
+if (value.lower() != "utf-8")
   D.Diag(diag::err_drv_invalid_value) << execCharset->getAsString(Args)

I'd use `compare_lower` because `lower` introduces a `std::string`.


https://reviews.llvm.org/D23938



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23938: clang-cl: Accept MSVC 2015's `/execution-charset:utf-8` flag.

2016-08-26 Thread Nico Weber via cfe-commits
thakis updated this revision to Diff 69416.
thakis added a comment.

!!


https://reviews.llvm.org/D23938

Files:
  include/clang/Driver/CLCompatOptions.td
  lib/Driver/Tools.cpp
  test/Driver/cl-options.c

Index: test/Driver/cl-options.c
===
--- test/Driver/cl-options.c
+++ test/Driver/cl-options.c
@@ -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 \
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5843,7 +5843,7 @@
   // -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.lower() != "utf-8")
   D.Diag(diag::err_drv_invalid_value) << execCharset->getAsString(Args)
   << value;
   }
Index: include/clang/Driver/CLCompatOptions.td
===
--- include/clang/Driver/CLCompatOptions.td
+++ include/clang/Driver/CLCompatOptions.td
@@ -122,6 +122,8 @@
   Alias;
 def _SLASH_source_charset : CLCompileJoined<"source-charset:">,
   HelpText<"Source encoding, supports only UTF-8">, Alias;
+def _SLASH_execution_charset : CLCompileJoined<"execution-charset:">,
+  HelpText<"Runtime encoding, supports only UTF-8">, Alias;
 def _SLASH_std : CLCompileJoined<"std:">,
   HelpText<"Language standard to compile for">;
 def _SLASH_U : CLJoinedOrSeparate<"U">, HelpText<"Undefine macro">,


Index: test/Driver/cl-options.c
===
--- test/Driver/cl-options.c
+++ test/Driver/cl-options.c
@@ -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 \
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5843,7 +5843,7 @@
   // -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.lower() != "utf-8")
   D.Diag(diag::err_drv_invalid_value) << execCharset->getAsString(Args)
   << value;
   }
Index: include/clang/Driver/CLCompatOptions.td
===
--- include/clang/Driver/CLCompatOptions.td
+++ include/clang/Driver/CLCompatOptions.td
@@ -122,6 +122,8 @@
   Alias;
 def _SLASH_source_charset : CLCompileJoined<"source-charset:">,
   HelpText<"Source encoding, supports only UTF-8">, Alias;
+def _SLASH_execution_charset : CLCompileJoined<"execution-charset:">,
+  HelpText<"Runtime encoding, supports only UTF-8">, Alias;
 def _SLASH_std : CLCompileJoined<"std:">,
   HelpText<"Language standard to compile for">;
 def _SLASH_U : CLJoinedOrSeparate<"U">, HelpText<"Undefine macro">,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23938: clang-cl: Accept MSVC 2015's `/execution-charset:utf-8` flag.

2016-08-26 Thread Nico Weber via cfe-commits
thakis updated this revision to Diff 69415.
thakis added a comment.

;-;


https://reviews.llvm.org/D23938

Files:
  include/clang/Driver/CLCompatOptions.td
  lib/Driver/Tools.cpp
  test/Driver/cl-options.c

Index: test/Driver/cl-options.c
===
--- test/Driver/cl-options.c
+++ test/Driver/cl-options.c
@@ -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 \
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5843,7 +5843,7 @@
   // -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.lower != "utf-8")
   D.Diag(diag::err_drv_invalid_value) << execCharset->getAsString(Args)
   << value;
   }
Index: include/clang/Driver/CLCompatOptions.td
===
--- include/clang/Driver/CLCompatOptions.td
+++ include/clang/Driver/CLCompatOptions.td
@@ -122,6 +122,8 @@
   Alias;
 def _SLASH_source_charset : CLCompileJoined<"source-charset:">,
   HelpText<"Source encoding, supports only UTF-8">, Alias;
+def _SLASH_execution_charset : CLCompileJoined<"execution-charset:">,
+  HelpText<"Runtime encoding, supports only UTF-8">, Alias;
 def _SLASH_std : CLCompileJoined<"std:">,
   HelpText<"Language standard to compile for">;
 def _SLASH_U : CLJoinedOrSeparate<"U">, HelpText<"Undefine macro">,


Index: test/Driver/cl-options.c
===
--- test/Driver/cl-options.c
+++ test/Driver/cl-options.c
@@ -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 \
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5843,7 +5843,7 @@
   // -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.lower != "utf-8")
   D.Diag(diag::err_drv_invalid_value) << execCharset->getAsString(Args)
   << value;
   }
Index: include/clang/Driver/CLCompatOptions.td
===
--- include/clang/Driver/CLCompatOptions.td
+++ include/clang/Driver/CLCompatOptions.td
@@ -122,6 +122,8 @@
   Alias;
 def _SLASH_source_charset : CLCompileJoined<"source-charset:">,
   HelpText<"Source encoding, supports only UTF-8">, Alias;
+def _SLASH_execution_charset : CLCompileJoined<"execution-charset:">,
+  HelpText<"Runtime encoding, supports only UTF-8">, Alias;
 def _SLASH_std : CLCompileJoined<"std:">,
   HelpText<"Language standard to compile for">;
 def _SLASH_U : CLJoinedOrSeparate<"U">, HelpText<"Undefine macro">,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23938: clang-cl: Accept MSVC 2015's `/execution-charset:utf-8` flag.

2016-08-26 Thread David Majnemer via cfe-commits
On Friday, August 26, 2016, Nico Weber via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> thakis created this revision.
> thakis added a reviewer: hans.
> thakis added a subscriber: cfe-commits.
>
> Like https://reviews.llvm.org/D23807, but for execution-charset.
>
> https://reviews.llvm.org/D23938
>
> Files:
>   include/clang/Driver/CLCompatOptions.td
>   lib/Driver/Tools.cpp
>   test/Driver/cl-options.c
>
> Index: test/Driver/cl-options.c
> ===
> --- test/Driver/cl-options.c
> +++ test/Driver/cl-options.c
> @@ -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 \
> Index: lib/Driver/Tools.cpp
> ===
> --- lib/Driver/Tools.cpp
> +++ lib/Driver/Tools.cpp
> @@ -5843,7 +5843,7 @@
>// -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.lower() != "UTF-8")


Should that be "utf-8" instead?


>D.Diag(diag::err_drv_invalid_value) <<
> execCharset->getAsString(Args)
><< value;
>}
> Index: include/clang/Driver/CLCompatOptions.td
> ===
> --- include/clang/Driver/CLCompatOptions.td
> +++ include/clang/Driver/CLCompatOptions.td
> @@ -122,6 +122,8 @@
>Alias;
>  def _SLASH_source_charset : CLCompileJoined<"source-charset:">,
>HelpText<"Source encoding, supports only UTF-8">,
> Alias;
> +def _SLASH_execution_charset : CLCompileJoined<"execution-charset:">,
> +  HelpText<"Runtime encoding, supports only UTF-8">,
> Alias;
>  def _SLASH_std : CLCompileJoined<"std:">,
>HelpText<"Language standard to compile for">;
>  def _SLASH_U : CLJoinedOrSeparate<"U">, HelpText<"Undefine macro">,
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits