diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-12-14 13:15:08 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-12-14 13:15:08 +0000 |
commit | 6c3c48f7a30186ac9d31b7e913c61786ae6526e7 (patch) | |
tree | 94ce559787a2d2dded184f4813ed4eb029700f2f /include/clang/Basic/DiagnosticLexKinds.td | |
parent | f38a7e77a530c9c439c9b49f033deabf00a569bd (diff) |
Warn if we find a Unicode homoglyph for a symbol in an identifier.
Specifically, warn if:
* we find a character that the language standard says we must treat as an
identifier, and
* that character is not reasonably an identifier character (it's a punctuation
character or similar), and
* it renders identically to a valid non-identifier character in common
fixed-width fonts.
Some tools "helpfully" substitute the surprising characters for the expected
characters, and replacing semicolons with Greek question marks is a common
"prank".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320697 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/DiagnosticLexKinds.td')
-rw-r--r-- | include/clang/Basic/DiagnosticLexKinds.td | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/clang/Basic/DiagnosticLexKinds.td b/include/clang/Basic/DiagnosticLexKinds.td index 89874b50f6..c664281ffc 100644 --- a/include/clang/Basic/DiagnosticLexKinds.td +++ b/include/clang/Basic/DiagnosticLexKinds.td @@ -119,6 +119,9 @@ def err_non_ascii : Error< def ext_unicode_whitespace : ExtWarn< "treating Unicode character as whitespace">, InGroup<DiagGroup<"unicode-whitespace">>; +def warn_utf8_symbol_homoglyph : Warning< + "treating Unicode character <U+%0> as identifier character rather than " + "as '%1' symbol">, InGroup<DiagGroup<"unicode-homoglyph">>; def err_hex_escape_no_digits : Error< "\\%0 used with no following hex digits">; |