[clang] 3ab5927 - [Clang][Comments] Make @relates an inline comment command (#115040)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 12 11:18:32 PST 2024
Author: Krystian Stasiowski
Date: 2024-11-12T14:18:28-05:00
New Revision: 3ab5927b971c2cf758c68d36200ef8ec97916034
URL: https://github.com/llvm/llvm-project/commit/3ab5927b971c2cf758c68d36200ef8ec97916034
DIFF: https://github.com/llvm/llvm-project/commit/3ab5927b971c2cf758c68d36200ef8ec97916034.diff
LOG: [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.
Added:
Modified:
clang/docs/ReleaseNotes.rst
clang/include/clang/AST/CommentCommands.td
clang/test/AST/ast-dump-comment.cpp
Removed:
################################################################################
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index e0294490e63d67..ffed972ed120d0 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -662,6 +662,8 @@ Bug Fixes to AST Handling
- Fixed a crash that occurred when dividing by zero in complex integer division. (#GH55390).
- Fixed a bug in ``ASTContext::getRawCommentForAnyRedecl()`` where the function could
sometimes incorrectly return null even if a comment was present. (#GH108145)
+- Clang now correctly parses the argument of the ``relates``, ``related``, ``relatesalso``,
+ and ``relatedalso`` comment commands.
Miscellaneous Bug Fixes
^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/clang/include/clang/AST/CommentCommands.td b/clang/include/clang/AST/CommentCommands.td
index a410cd4039bee1..f6dd67dc2590f0 100644
--- a/clang/include/clang/AST/CommentCommands.td
+++ b/clang/include/clang/AST/CommentCommands.td
@@ -111,6 +111,11 @@ def Extends : InlineCommand<"extends">;
def Implements : InlineCommand<"implements">;
def MemberOf : InlineCommand<"memberof">;
+def Relates : InlineCommand<"relates">;
+def Related : InlineCommand<"related">;
+def RelatesAlso : InlineCommand<"relatesalso">;
+def RelatedAlso : InlineCommand<"relatedalso">;
+
//===----------------------------------------------------------------------===//
// BlockCommand
//===----------------------------------------------------------------------===//
@@ -248,11 +253,6 @@ def Page : VerbatimLineCommand<"page">;
def Mainpage : VerbatimLineCommand<"mainpage">;
def Subpage : VerbatimLineCommand<"subpage">;
-def Relates : VerbatimLineCommand<"relates">;
-def Related : VerbatimLineCommand<"related">;
-def RelatesAlso : VerbatimLineCommand<"relatesalso">;
-def RelatedAlso : VerbatimLineCommand<"relatedalso">;
-
def AddIndex : VerbatimLineCommand<"addindex">;
// These take a single argument mostly, but since they include a file they'll
diff --git a/clang/test/AST/ast-dump-comment.cpp b/clang/test/AST/ast-dump-comment.cpp
index 8b058911d614d7..9798295b420f9a 100644
--- a/clang/test/AST/ast-dump-comment.cpp
+++ b/clang/test/AST/ast-dump-comment.cpp
@@ -73,6 +73,11 @@ int Test_InlineCommandCommentAnchor;
// CHECK: VarDecl{{.*}}Test_InlineCommandComment
// CHECK: InlineCommandComment{{.*}} Name="anchor" RenderAnchor Arg[0]="Aaa"
+/// \relates Aaa
+int Test_InlineCommandCommentRelates;
+// CHECK: VarDecl{{.*}}Test_InlineCommandCommentRelates
+// CHECK: InlineCommandComment{{.*}} Name="relates" RenderNormal Arg[0]="Aaa"
+
/// <a>Aaa</a>
/// <br/>
int Test_HTMLTagComment;
More information about the cfe-commits
mailing list