-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Clang] Handle non-ASCII after line splicing
int a\ ス; Failed to be parsed as a valid identifier. Fixes #65156 Reviewed By: tahonermann Differential Revision: https://reviews.llvm.org/D159345
- Loading branch information
Showing
4 changed files
with
70 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// RUN: %clang_cc1 -verify=expected,c -x c -Wunused %s | ||
// RUN: %clang_cc1 -verify=expected,cpp -x c++ -Wunused %s | ||
|
||
void gh65156(void) { | ||
|
||
int a\ | ||
ス = 42; | ||
// expected-warning@-2 {{unused variable 'aス'}} | ||
|
||
int b\ | ||
\ | ||
ス = 42; | ||
// expected-warning@-2 {{backslash and newline separated by space}} | ||
// expected-warning@-4 {{backslash and newline separated by space}} | ||
// expected-warning@-5 {{unused variable 'bス'}} | ||
|
||
int ス\ | ||
ス = 42; | ||
// expected-warning@-2 {{unused variable 'スス'}} | ||
|
||
int \ | ||
ス = 42; | ||
// expected-warning@-2 {{unused variable 'ス'}} | ||
|
||
} | ||
|
||
void gh65156_err(void) { | ||
|
||
int \ | ||
❌ = 0; | ||
// cpp-error@-2 {{expected unqualified-id}} | ||
// c-error@-3 {{expected identifier}} | ||
|
||
|
||
int a\ | ||
❌ = 0; | ||
// expected-error@-1 {{character <U+274C> not allowed in an identifier}} | ||
} |