This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG99d35826a043: Comment parsing: Specify argument numbers for some block commands (authored by aaronpuchert).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125422/new/ https://reviews.llvm.org/D125422 Files: clang/include/clang/AST/CommentCommands.td clang/test/AST/ast-dump-comment.cpp clang/test/Sema/warn-documentation.cpp Index: clang/test/Sema/warn-documentation.cpp =================================================================== --- clang/test/Sema/warn-documentation.cpp +++ clang/test/Sema/warn-documentation.cpp @@ -189,6 +189,14 @@ int test_multiple_returns4(int); +/// expected-warning@+1 {{empty paragraph passed to '\retval' command}} +/// \retval 0 +int test_retval_no_paragraph(); + +/// \retval 0 Everything is fine. +int test_retval_fine(); + + // expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}} /// \param a Blah blah. int test_param1_backslash; Index: clang/test/AST/ast-dump-comment.cpp =================================================================== --- clang/test/AST/ast-dump-comment.cpp +++ clang/test/AST/ast-dump-comment.cpp @@ -32,6 +32,13 @@ // CHECK-NEXT: ParagraphComment // CHECK-NEXT: TextComment{{.*}} Text=" Aaa" +/// \retval 42 Aaa +int Test_BlockCommandComment_WithArgs(); +// CHECK: FunctionDecl{{.*}}Test_BlockCommandComment_WithArgs +// CHECK: BlockCommandComment{{.*}} Name="retval" Arg[0]="42" +// CHECK-NEXT: ParagraphComment +// CHECK-NEXT: TextComment{{.*}} Text=" Aaa" + /// \param Aaa xxx /// \param [in,out] Bbb yyy void Test_ParamCommandComment(int Aaa, int Bbb); Index: clang/include/clang/AST/CommentCommands.td =================================================================== --- clang/include/clang/AST/CommentCommands.td +++ clang/include/clang/AST/CommentCommands.td @@ -154,7 +154,7 @@ def Pre : BlockCommand<"pre">; def Remark : BlockCommand<"remark">; def Remarks : BlockCommand<"remarks">; -def Retval : BlockCommand<"retval">; +def Retval : BlockCommand<"retval"> { let NumArgs = 1; } def Sa : BlockCommand<"sa">; def See : BlockCommand<"see">; def Since : BlockCommand<"since">; @@ -162,7 +162,7 @@ def Todo : BlockCommand<"todo">; def Version : BlockCommand<"version">; def Warning : BlockCommand<"warning">; -def XRefItem : BlockCommand<"xrefitem">; +def XRefItem : BlockCommand<"xrefitem"> { let NumArgs = 3; } // HeaderDoc commands def Abstract : BlockCommand<"abstract"> { let IsBriefCommand = 1; } def ClassDesign : RecordLikeDetailCommand<"classdesign">;
Index: clang/test/Sema/warn-documentation.cpp =================================================================== --- clang/test/Sema/warn-documentation.cpp +++ clang/test/Sema/warn-documentation.cpp @@ -189,6 +189,14 @@ int test_multiple_returns4(int); +/// expected-warning@+1 {{empty paragraph passed to '\retval' command}} +/// \retval 0 +int test_retval_no_paragraph(); + +/// \retval 0 Everything is fine. +int test_retval_fine(); + + // expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}} /// \param a Blah blah. int test_param1_backslash; Index: clang/test/AST/ast-dump-comment.cpp =================================================================== --- clang/test/AST/ast-dump-comment.cpp +++ clang/test/AST/ast-dump-comment.cpp @@ -32,6 +32,13 @@ // CHECK-NEXT: ParagraphComment // CHECK-NEXT: TextComment{{.*}} Text=" Aaa" +/// \retval 42 Aaa +int Test_BlockCommandComment_WithArgs(); +// CHECK: FunctionDecl{{.*}}Test_BlockCommandComment_WithArgs +// CHECK: BlockCommandComment{{.*}} Name="retval" Arg[0]="42" +// CHECK-NEXT: ParagraphComment +// CHECK-NEXT: TextComment{{.*}} Text=" Aaa" + /// \param Aaa xxx /// \param [in,out] Bbb yyy void Test_ParamCommandComment(int Aaa, int Bbb); Index: clang/include/clang/AST/CommentCommands.td =================================================================== --- clang/include/clang/AST/CommentCommands.td +++ clang/include/clang/AST/CommentCommands.td @@ -154,7 +154,7 @@ def Pre : BlockCommand<"pre">; def Remark : BlockCommand<"remark">; def Remarks : BlockCommand<"remarks">; -def Retval : BlockCommand<"retval">; +def Retval : BlockCommand<"retval"> { let NumArgs = 1; } def Sa : BlockCommand<"sa">; def See : BlockCommand<"see">; def Since : BlockCommand<"since">; @@ -162,7 +162,7 @@ def Todo : BlockCommand<"todo">; def Version : BlockCommand<"version">; def Warning : BlockCommand<"warning">; -def XRefItem : BlockCommand<"xrefitem">; +def XRefItem : BlockCommand<"xrefitem"> { let NumArgs = 3; } // HeaderDoc commands def Abstract : BlockCommand<"abstract"> { let IsBriefCommand = 1; } def ClassDesign : RecordLikeDetailCommand<"classdesign">;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits