summaryrefslogtreecommitdiffstats
path: root/clang/test/Lexer
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-12-14 13:15:08 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-12-14 13:15:08 +0000
commit77091b167fd959e1ee0c4dad4ec44de43b6c95db (patch)
tree9e068262e88c9ae489457581de5bd31c914d2a78 /clang/test/Lexer
parentbf484aa0f137c88729136f5a477e0a0594a58769 (diff)
downloadbcm5719-llvm-77091b167fd959e1ee0c4dad4ec44de43b6c95db.tar.gz
bcm5719-llvm-77091b167fd959e1ee0c4dad4ec44de43b6c95db.zip
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". llvm-svn: 320697
Diffstat (limited to 'clang/test/Lexer')
-rw-r--r--clang/test/Lexer/unicode.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/test/Lexer/unicode.c b/clang/test/Lexer/unicode.c
index 30805d1acb2..30e353fa797 100644
--- a/clang/test/Lexer/unicode.c
+++ b/clang/test/Lexer/unicode.c
@@ -33,3 +33,8 @@ int main () {
int 🌷 = 🌵(🌹);
return 🌷;
}
+
+int n; = 3; // expected-warning {{treating Unicode character <U+037E> as identifier character rather than as ';' symbol}}
+int *n꞉꞉v = &n;; // expected-warning 2{{treating Unicode character <U+A789> as identifier character rather than as ':' symbol}}
+ // expected-warning@-1 {{treating Unicode character <U+037E> as identifier character rather than as ';' symbol}}
+int v=[=](auto){return~x;}(); // expected-warning 12{{treating Unicode character}}
OpenPOWER on IntegriCloud