
Introduce an off-by default `-Winvalid-utf8` warning that detects invalid UTF-8 code units sequences in comments. Invalid UTF-8 in other places is already diagnosed, as that cannot appear in identifiers and other grammar constructs. The warning is off by default as its likely to be somewhat disruptive otherwise. This warning allows clang to conform to the yet-to be approved WG21 "P2295R5 Support for UTF-8 as a portable source file encoding" paper. Reviewed By: aaron.ballman, #clang-language-wg Differential Revision: https://reviews.llvm.org/D128059
28 lines
701 B
C
28 lines
701 B
C
// RUN: %clang_cc1 -fsyntax-only %s -Winvalid-utf8 -verify
|
||
// expected-no-diagnostics
|
||
|
||
|
||
//§ § § 😀 你好 ©
|
||
|
||
/*§ § § 😀 你好 ©*/
|
||
|
||
/*
|
||
§ § § 😀 你好 ©©©
|
||
*/
|
||
|
||
/* § § § 😀 你好 © */
|
||
/*
|
||
a longer comment to exerce the vectorized code path
|
||
----------------------------------------------------
|
||
αααααααααααααααααααααα // here is some unicode
|
||
----------------------------------------------------
|
||
----------------------------------------------------
|
||
*/
|
||
|
||
// The following test checks that a short comment is not merged
|
||
// with a subsequent long comment containing utf-8
|
||
enum a {
|
||
x /* 01234567890ABCDEF*/
|
||
};
|
||
/*ααααααααα*/
|