[clang] [Clang][Comments] Make @relates an inline comment command (PR #115040)

Krystian Stasiowski via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 5 10:06:03 PST 2024


https://github.com/sdkrystian created https://github.com/llvm/llvm-project/pull/115040

According to the [Doxygen documentation](https://www.doxygen.nl/manual/commands.html#cmdrelates), the `relates`, `related`, `relatesalso`, and `relatedalso` commands all have a single argument. This patch changes their classification from `VerbatimLineCommand` to `InlineCommand` so arguments are correctly parsed. 

>From cba8a46cd0dcbdf5079712354e5d0829199e0e08 Mon Sep 17 00:00:00 2001
From: Krystian Stasiowski <sdkrystian at gmail.com>
Date: Tue, 5 Nov 2024 12:59:42 -0500
Subject: [PATCH] [Clang][Comments] Make @relates an inline comment command

---
 clang/docs/ReleaseNotes.rst                |  2 ++
 clang/include/clang/AST/CommentCommands.td | 10 +++++-----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 4e555914caee8a..fda5b0213e7ec7 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -598,6 +598,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



More information about the cfe-commits mailing list