diff options
| author | Nico Weber <nicolasweber@gmx.de> | 2016-08-26 21:51:14 +0000 |
|---|---|---|
| committer | Nico Weber <nicolasweber@gmx.de> | 2016-08-26 21:51:14 +0000 |
| commit | 9084adc290c24bd9e52046ef5771e7c83a6e6c34 (patch) | |
| tree | 0802043e12f585e886d6cc0e8ef9929154dd6b96 /clang/test/Driver/cl-options.c | |
| parent | 70984fed05c211f5c74b5038fefe1d99d45b64d4 (diff) | |
| download | bcm5719-llvm-9084adc290c24bd9e52046ef5771e7c83a6e6c34.tar.gz bcm5719-llvm-9084adc290c24bd9e52046ef5771e7c83a6e6c34.zip | |
clang-cl: Support MSVC2015's /validate-charset flag.
Clang always assumes that files are utf-8. If an invalidly encoded character is
used in an identifier, clang always errors. If it's used in a character
literal, clang warns Winvalid-source-encoding (on by default). Clang never
checks the encoding of things in comments (adding this seems like a nice
feature if it doesn't impact performance).
For cl.exe /utf-8 (which enables /validate-charset), if a bad character is used
in an identifier, it emits both an error and a warning. If it's used in a
literal or a comment, it emits a warning.
So mapping /validate-charset to -Winvalid-source-encoding seems like a fairly
decent fit.
https://reviews.llvm.org/D23945
llvm-svn: 279872
Diffstat (limited to 'clang/test/Driver/cl-options.c')
| -rw-r--r-- | clang/test/Driver/cl-options.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c index ba70378b2f2..e5e540207cf 100644 --- a/clang/test/Driver/cl-options.c +++ b/clang/test/Driver/cl-options.c @@ -192,6 +192,12 @@ // RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s // U: "-U" "mymacro" +// RUN: %clang_cl /validate-charset -### -- %s 2>&1 | FileCheck -check-prefix=validate-charset %s +// validate-charset: -Winvalid-source-encoding + +// RUN: %clang_cl /validate-charset- -### -- %s 2>&1 | FileCheck -check-prefix=validate-charset_ %s +// validate-charset_: -Wno-invalid-source-encoding + // RUN: %clang_cl /vd2 -### -- %s 2>&1 | FileCheck -check-prefix=VD2 %s // VD2: -vtordisp-mode=2 |

