Skip to content

Commit 475d513

Browse files
author
Brock Denson
committed
[clang] fix comment parsing of special commands with non-alphanumeric names. fixes #33296
1 parent 6f53f1c commit 475d513

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

clang/lib/AST/CommentLexer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ bool isCommandNameStartCharacter(char C) {
214214
}
215215

216216
bool isCommandNameCharacter(char C) {
217-
return isAlphanumeric(C);
217+
return isAsciiIdentifierContinue(C, false);
218218
}
219219

220220
const char *skipCommandName(const char *BufferPtr, const char *BufferEnd) {

clang/test/AST/ast-dump-comment.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,9 @@ void Test_TemplatedFunctionVariadic(int arg, ...);
131131
// CHECK: ParamCommandComment{{.*}} [in] implicitly Param="..."
132132
// CHECK-NEXT: ParagraphComment
133133
// CHECK-NEXT: TextComment{{.*}} Text=" More arguments"
134+
135+
/// \thread_safe test for underscore in special command
136+
int Test_UnderscoreInSpecialCommand;
137+
// CHECK: VarDecl{{.*}}Test_UnderscoreInSpecialCommand 'int'
138+
// CHECK: InlineCommandComment{{.*}} Name="thread_safe" RenderNormal
139+
// CHECK-NEXT: TextComment{{.*}} Text=" test for underscore in special command"

0 commit comments

Comments
 (0)