]> granicus.if.org Git - clang/commit
Warn if we find a Unicode homoglyph for a symbol in an identifier.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 14 Dec 2017 13:15:08 +0000 (13:15 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 14 Dec 2017 13:15:08 +0000 (13:15 +0000)
commit6c3c48f7a30186ac9d31b7e913c61786ae6526e7
tree94ce559787a2d2dded184f4813ed4eb029700f2f
parentf38a7e77a530c9c439c9b49f033deabf00a569bd
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
include/clang/Basic/DiagnosticLexKinds.td
lib/Lex/Lexer.cpp
test/Lexer/unicode.c