[clang] f23df1b - Comment parsing: Treat \ref as inline command

Aaron Puchert via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 5 10:45:07 PST 2020


Author: Aaron Puchert
Date: 2020-03-05T19:44:34+01:00
New Revision: f23df1b2a323094e5a6869ef085f100fd065bc0d

URL: https://github.com/llvm/llvm-project/commit/f23df1b2a323094e5a6869ef085f100fd065bc0d
DIFF: https://github.com/llvm/llvm-project/commit/f23df1b2a323094e5a6869ef085f100fd065bc0d.diff

LOG: Comment parsing: Treat \ref as inline command

Summary:
It's basically Doxygen's version of a link and can happen anywhere
inside of a paragraph. Fixes a bogus warning about empty paragraphs when
a parameter description starts with a link.

Reviewers: gribozavr2

Reviewed By: gribozavr2

Differential Revision: https://reviews.llvm.org/D75632

Added: 
    

Modified: 
    clang/include/clang/AST/CommentCommands.td
    clang/test/Sema/warn-documentation.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/CommentCommands.td b/clang/include/clang/AST/CommentCommands.td
index d387df7ce570..fbbfc9f7e0b7 100644
--- a/clang/include/clang/AST/CommentCommands.td
+++ b/clang/include/clang/AST/CommentCommands.td
@@ -87,6 +87,7 @@ def P      : InlineCommand<"p">;
 def A      : InlineCommand<"a">;
 def E      : InlineCommand<"e">;
 def Em     : InlineCommand<"em">;
+def Ref    : InlineCommand<"ref">;
 def Anchor : InlineCommand<"anchor">;
 
 //===----------------------------------------------------------------------===//
@@ -205,7 +206,6 @@ def Paragraph     : VerbatimLineCommand<"paragraph">;
 
 def Mainpage : VerbatimLineCommand<"mainpage">;
 def Subpage  : VerbatimLineCommand<"subpage">;
-def Ref      : VerbatimLineCommand<"ref">;
 
 def Relates     : VerbatimLineCommand<"relates">;
 def Related     : VerbatimLineCommand<"related">;

diff  --git a/clang/test/Sema/warn-documentation.cpp b/clang/test/Sema/warn-documentation.cpp
index 3091c2f34783..2b2a3d15304a 100644
--- a/clang/test/Sema/warn-documentation.cpp
+++ b/clang/test/Sema/warn-documentation.cpp
@@ -294,6 +294,9 @@ int test_param22(int x1, int x2, int x3);
 /// \retval 0 Blah blah.
 int test_param23(int a);
 
+/// \param a \ref test_param23 has an empty paragraph, this doesn't.
+int test_param24(int a);
+
 //===---
 // Test that we treat typedefs to some non-function types as functions for the
 // purposes of documentation comment parsing.


        


More information about the cfe-commits mailing list