================
@@ -550,6 +555,27 @@ static void DiagnoseInvalidUnicodeCharacterName(
namespace u = llvm::sys::unicode;
+ bool HasIllegalCharacter = false;
+ for (const char *P = Name.begin(), *E = Name.end(); P != E;) {
+ if (allowedInCharacterName(*P)) {
+ ++P;
+ continue;
+ }
+ const auto *Src = reinterpret_cast<const llvm::UTF8 *>(P);
+ const auto *SrcEnd = reinterpret_cast<const llvm::UTF8 *>(E);
+ llvm::UTF32 CodePoint = 0;
+ if (llvm::convertUTF8Sequence(&Src, SrcEnd, &CodePoint,
+ llvm::strictConversion) !=
llvm::conversionOK)
+ break;
----------------
eisenwave wrote:
I do now for `DisplayCodePointForDiagnosticTest`, but not for this.
Can you even test this? I would have expected that some earlier stage would
kill lexing if your text file isn't valid UTF-8, or that lexing wouldn't happen
in the first place.
I could also add an `assert` that this part always succeeds, since it's not
really intended to fail.
https://github.com/llvm/llvm-project/pull/206326
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits