These should be all the commands from [1] except those that are marked obsolete, and "link" / "endlink", as that conflicts with the existing HeaderDoc pair "link / "/link". For some commands we don't have the ideal category, but it should work good enough for most cases. There seems to be no existing test for most commands (except the ones interpreted by -Wdocumentation), and to some extent such a test wouldn't look very interesting. But I added a test for the correct parsing of formulas, as they're a bit special. And I had to adapt comment-lots-of-unknown-commands.c because typo correction was kicking in and recognizing some of the commands. This should fix a couple of reported bugs: PR17437, PR19581, PR24062 (partially, no diagnostic for matching cond/endcond), PR32909, PR37813, PR44243 (partially, email@domain.com must be addressed separately). [1] https://www.doxygen.nl/manual/commands.html Reviewed By: gribozavr2 Differential Revision: https://reviews.llvm.org/D111190
103 lines
3.9 KiB
C++
103 lines
3.9 KiB
C++
// Without serialization:
|
|
// RUN: %clang_cc1 -Wdocumentation -ast-dump -ast-dump-filter Test %s \
|
|
// RUN: | FileCheck -strict-whitespace %s
|
|
//
|
|
// With serialization:
|
|
// RUN: %clang_cc1 -Wdocumentation -emit-pch -o %t %s
|
|
// RUN: %clang_cc1 -x c++ -Wdocumentation -include-pch %t -ast-dump-all -ast-dump-filter Test /dev/null \
|
|
// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
|
|
// RUN: | FileCheck --strict-whitespace %s
|
|
|
|
/// Aaa
|
|
int TestLocation;
|
|
// CHECK: VarDecl{{.*}}TestLocation
|
|
// CHECK-NEXT: FullComment 0x{{[^ ]*}} <line:[[@LINE-3]]:4, col:7>
|
|
|
|
///
|
|
int TestIndent;
|
|
// CHECK: {{^VarDecl.*TestIndent[^()]*$}}
|
|
// CHECK-NEXT: {{^`-FullComment.*>$}}
|
|
|
|
/// Aaa
|
|
int Test_TextComment;
|
|
// CHECK: VarDecl{{.*}}Test_TextComment
|
|
// CHECK-NEXT: FullComment
|
|
// CHECK-NEXT: ParagraphComment
|
|
// CHECK-NEXT: TextComment{{.*}} Text=" Aaa"
|
|
|
|
/// \brief Aaa
|
|
int Test_BlockCommandComment;
|
|
// CHECK: VarDecl{{.*}}Test_BlockCommandComment
|
|
// CHECK: BlockCommandComment{{.*}} Name="brief"
|
|
// CHECK-NEXT: ParagraphComment
|
|
// CHECK-NEXT: TextComment{{.*}} Text=" Aaa"
|
|
|
|
/// \param Aaa xxx
|
|
/// \param [in,out] Bbb yyy
|
|
void Test_ParamCommandComment(int Aaa, int Bbb);
|
|
// CHECK: FunctionDecl{{.*}}Test_ParamCommandComment
|
|
// CHECK: ParamCommandComment{{.*}} [in] implicitly Param="Aaa" ParamIndex=0
|
|
// CHECK-NEXT: ParagraphComment
|
|
// CHECK-NEXT: TextComment{{.*}} Text=" xxx"
|
|
// CHECK: ParamCommandComment{{.*}} [in,out] explicitly Param="Bbb" ParamIndex=1
|
|
// CHECK-NEXT: ParagraphComment
|
|
// CHECK-NEXT: TextComment{{.*}} Text=" yyy"
|
|
|
|
/// \tparam Aaa xxx
|
|
template <typename Aaa> class Test_TParamCommandComment;
|
|
// CHECK: ClassTemplateDecl{{.*}}Test_TParamCommandComment
|
|
// CHECK: TParamCommandComment{{.*}} Param="Aaa" Position=<0>
|
|
// CHECK-NEXT: ParagraphComment
|
|
// CHECK-NEXT: TextComment{{.*}} Text=" xxx"
|
|
|
|
/// \c Aaa
|
|
int Test_InlineCommandComment;
|
|
// CHECK: VarDecl{{.*}}Test_InlineCommandComment
|
|
// CHECK: InlineCommandComment{{.*}} Name="c" RenderMonospaced Arg[0]="Aaa"
|
|
|
|
/// \anchor Aaa
|
|
int Test_InlineCommandCommentAnchor;
|
|
// CHECK: VarDecl{{.*}}Test_InlineCommandComment
|
|
// CHECK: InlineCommandComment{{.*}} Name="anchor" RenderAnchor Arg[0]="Aaa"
|
|
|
|
/// <a>Aaa</a>
|
|
/// <br/>
|
|
int Test_HTMLTagComment;
|
|
// CHECK: VarDecl{{.*}}Test_HTMLTagComment
|
|
// CHECK-NEXT: FullComment
|
|
// CHECK-NEXT: ParagraphComment
|
|
// CHECK-NEXT: TextComment{{.*}} Text=" "
|
|
// CHECK-NEXT: HTMLStartTagComment{{.*}} Name="a"
|
|
// CHECK-NEXT: TextComment{{.*}} Text="Aaa"
|
|
// CHECK-NEXT: HTMLEndTagComment{{.*}} Name="a"
|
|
// CHECK-NEXT: TextComment{{.*}} Text=" "
|
|
// CHECK-NEXT: HTMLStartTagComment{{.*}} Name="br" SelfClosing
|
|
|
|
/// \verbatim
|
|
/// Aaa
|
|
/// \endverbatim
|
|
/// \f$ a \f$
|
|
/// \f( b \f)
|
|
/// \f[ c \f]
|
|
/// \f{env}{ c \f}
|
|
int Test_VerbatimBlockComment;
|
|
// CHECK: VarDecl{{.*}}Test_VerbatimBlockComment
|
|
// CHECK: VerbatimBlockComment{{.*}} Name="verbatim" CloseName="endverbatim"
|
|
// CHECK-NEXT: VerbatimBlockLineComment{{.*}} Text=" Aaa"
|
|
// CHECK: VerbatimBlockComment{{.*}} Name="f$" CloseName="f$"
|
|
// CHECK-NEXT: VerbatimBlockLineComment{{.*}} Text=" a "
|
|
// CHECK: VerbatimBlockComment{{.*}} Name="f(" CloseName="f)"
|
|
// CHECK-NEXT: VerbatimBlockLineComment{{.*}} Text=" b "
|
|
// CHECK: VerbatimBlockComment{{.*}} Name="f[" CloseName="f]"
|
|
// CHECK-NEXT: VerbatimBlockLineComment{{.*}} Text=" c "
|
|
// CHECK: VerbatimBlockComment{{.*}} Name="f{" CloseName="f}"
|
|
// CHECK-NEXT: VerbatimBlockLineComment{{.*}} Text="env}{ c "
|
|
|
|
/// \param ... More arguments
|
|
template<typename T>
|
|
void Test_TemplatedFunctionVariadic(int arg, ...);
|
|
// CHECK: FunctionTemplateDecl{{.*}}Test_TemplatedFunctionVariadic
|
|
// CHECK: ParamCommandComment{{.*}} [in] implicitly Param="..."
|
|
// CHECK-NEXT: ParagraphComment
|
|
// CHECK-NEXT: TextComment{{.*}} Text=" More arguments"
|