This is an archive of the discontinued LLVM Phabricator instance.

clang-cl: Support MSVC2015's /validate-charset flag.
ClosedPublic

Authored by thakis on Aug 26 2016, 2:53 PM.

Details

Reviewers
hans
Summary

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.

Diff Detail

Event Timeline

thakis updated this revision to Diff 69437.Aug 26 2016, 2:53 PM
thakis retitled this revision from to clang-cl: Support MSVC2015's /validate-charset flag..
thakis updated this object.
thakis added a reviewer: hans.
thakis added a subscriber: cfe-commits.
hans accepted this revision.Aug 26 2016, 2:57 PM
hans edited edge metadata.

lgtm

This revision is now accepted and ready to land.Aug 26 2016, 2:57 PM
thakis closed this revision.Aug 26 2016, 2:59 PM

r279872, thanks!