Skip to content

Commit 3ab5927

Browse files
authored
[Clang][Comments] Make @relates an inline comment command (#115040)
According to the Doxygen documentation, the `relates`, `related`, `relatesalso`, and `relatedalso` commands all have a single argument. This patch changes their classification from `VerbatimLineCommand` to `InlineCommand` so the argument is correctly parsed.
1 parent 30753af commit 3ab5927

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,8 @@ Bug Fixes to AST Handling
662662
- Fixed a crash that occurred when dividing by zero in complex integer division. (#GH55390).
663663
- Fixed a bug in ``ASTContext::getRawCommentForAnyRedecl()`` where the function could
664664
sometimes incorrectly return null even if a comment was present. (#GH108145)
665+
- Clang now correctly parses the argument of the ``relates``, ``related``, ``relatesalso``,
666+
and ``relatedalso`` comment commands.
665667

666668
Miscellaneous Bug Fixes
667669
^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/AST/CommentCommands.td

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ def Extends : InlineCommand<"extends">;
111111
def Implements : InlineCommand<"implements">;
112112
def MemberOf : InlineCommand<"memberof">;
113113

114+
def Relates : InlineCommand<"relates">;
115+
def Related : InlineCommand<"related">;
116+
def RelatesAlso : InlineCommand<"relatesalso">;
117+
def RelatedAlso : InlineCommand<"relatedalso">;
118+
114119
//===----------------------------------------------------------------------===//
115120
// BlockCommand
116121
//===----------------------------------------------------------------------===//
@@ -248,11 +253,6 @@ def Page : VerbatimLineCommand<"page">;
248253
def Mainpage : VerbatimLineCommand<"mainpage">;
249254
def Subpage : VerbatimLineCommand<"subpage">;
250255

251-
def Relates : VerbatimLineCommand<"relates">;
252-
def Related : VerbatimLineCommand<"related">;
253-
def RelatesAlso : VerbatimLineCommand<"relatesalso">;
254-
def RelatedAlso : VerbatimLineCommand<"relatedalso">;
255-
256256
def AddIndex : VerbatimLineCommand<"addindex">;
257257

258258
// These take a single argument mostly, but since they include a file they'll

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ int Test_InlineCommandCommentAnchor;
7373
// CHECK: VarDecl{{.*}}Test_InlineCommandComment
7474
// CHECK: InlineCommandComment{{.*}} Name="anchor" RenderAnchor Arg[0]="Aaa"
7575

76+
/// \relates Aaa
77+
int Test_InlineCommandCommentRelates;
78+
// CHECK: VarDecl{{.*}}Test_InlineCommandCommentRelates
79+
// CHECK: InlineCommandComment{{.*}} Name="relates" RenderNormal Arg[0]="Aaa"
80+
7681
/// <a>Aaa</a>
7782
/// <br/>
7883
int Test_HTMLTagComment;

0 commit comments

Comments
 (0)