182 lines · cpp
1// Without serialization:2// RUN: %clang_cc1 -Wdocumentation -ast-dump -ast-dump-filter Test %s \3// RUN: | FileCheck -strict-whitespace %s4//5// With serialization:6// RUN: %clang_cc1 -Wdocumentation -emit-pch -o %t %s7// RUN: %clang_cc1 -x c++ -Wdocumentation -include-pch %t -ast-dump-all -ast-dump-filter Test /dev/null \8// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \9// RUN: | FileCheck --strict-whitespace %s10 11/// Aaa12int TestLocation;13// CHECK: VarDecl{{.*}}TestLocation14// CHECK-NEXT: FullComment 0x{{[^ ]*}} <line:[[@LINE-3]]:4, col:7>15 16///17int TestIndent;18// CHECK: {{^VarDecl.*TestIndent[^()]*$}}19// CHECK-NEXT: {{^`-FullComment.*>$}}20 21/// Aaa22int Test_TextComment;23// CHECK: VarDecl{{.*}}Test_TextComment24// CHECK-NEXT: FullComment25// CHECK-NEXT: ParagraphComment26// CHECK-NEXT: TextComment{{.*}} Text=" Aaa"27 28/// \brief Aaa29int Test_BlockCommandComment;30// CHECK: VarDecl{{.*}}Test_BlockCommandComment31// CHECK: BlockCommandComment{{.*}} Name="brief"32// CHECK-NEXT: ParagraphComment33// CHECK-NEXT: TextComment{{.*}} Text=" Aaa"34 35/// \retval 42 Aaa36int Test_BlockCommandComment_WithArgs();37// CHECK: FunctionDecl{{.*}}Test_BlockCommandComment_WithArgs38// CHECK: BlockCommandComment{{.*}} Name="retval" Arg[0]="42"39// CHECK-NEXT: ParagraphComment40// CHECK-NEXT: TextComment{{.*}} Text=" Aaa"41 42/// \param Aaa xxx43/// \param [in,out] Bbb yyy44void Test_ParamCommandComment(int Aaa, int Bbb);45// CHECK: FunctionDecl{{.*}}Test_ParamCommandComment46// CHECK: ParamCommandComment{{.*}} [in] implicitly Param="Aaa" ParamIndex=047// CHECK-NEXT: ParagraphComment48// CHECK-NEXT: TextComment{{.*}} Text=" xxx"49// CHECK: ParamCommandComment{{.*}} [in,out] explicitly Param="Bbb" ParamIndex=150// CHECK-NEXT: ParagraphComment51// CHECK-NEXT: TextComment{{.*}} Text=" yyy"52 53/// \tparam Aaa xxx54template <typename Aaa> class Test_TParamCommandComment;55// CHECK: ClassTemplateDecl{{.*}}Test_TParamCommandComment56// CHECK: TParamCommandComment{{.*}} Param="Aaa" Position=<0>57// CHECK-NEXT: ParagraphComment58// CHECK-NEXT: TextComment{{.*}} Text=" xxx"59 60/// \c Aaa61int Test_InlineCommandComment;62// CHECK: VarDecl{{.*}}Test_InlineCommandComment63// CHECK: InlineCommandComment{{.*}} Name="c" RenderMonospaced Arg[0]="Aaa"64 65/// \n Aaa66int Test_InlineCommandComment_NoArgs;67// CHECK: VarDecl{{.*}}Test_InlineCommandComment_NoArgs68// CHECK: InlineCommandComment{{.*}} Name="n" RenderNormal69// CHECK-NEXT: TextComment{{.*}} Text=" Aaa"70 71/// \anchor Aaa72int Test_InlineCommandCommentAnchor;73// CHECK: VarDecl{{.*}}Test_InlineCommandComment74// CHECK: InlineCommandComment{{.*}} Name="anchor" RenderAnchor Arg[0]="Aaa"75 76/// \relates Aaa77int Test_InlineCommandCommentRelates;78// CHECK: VarDecl{{.*}}Test_InlineCommandCommentRelates79// CHECK: InlineCommandComment{{.*}} Name="relates" RenderNormal Arg[0]="Aaa"80 81/// <a>Aaa</a>82/// <br/>83int Test_HTMLTagComment;84// CHECK: VarDecl{{.*}}Test_HTMLTagComment85// CHECK-NEXT: FullComment86// CHECK-NEXT: ParagraphComment87// CHECK-NEXT: TextComment{{.*}} Text=" "88// CHECK-NEXT: HTMLStartTagComment{{.*}} Name="a"89// CHECK-NEXT: TextComment{{.*}} Text="Aaa"90// CHECK-NEXT: HTMLEndTagComment{{.*}} Name="a"91// CHECK-NEXT: TextComment{{.*}} Text=" "92// CHECK-NEXT: HTMLStartTagComment{{.*}} Name="br" SelfClosing93 94/// <a95/// href="foo"96/// >Aaa</a>b97int Test_HTMLTagMultilineBCPL;98// CHECK: VarDecl{{.*}}Test_HTMLTagMultilineBCPL99// CHECK-NEXT: FullComment100// CHECK-NEXT: ParagraphComment101// CHECK-NEXT: TextComment{{.*}} Text=" "102// CHECK-NEXT: HTMLStartTagComment{{.*}} Name="a" Attrs: "href="foo"103// CHECK-NEXT: TextComment{{.*}} Text="Aaa"104// CHECK-NEXT: HTMLEndTagComment{{.*}} Name="a"105// CHECK-NEXT: TextComment{{.*}} Text="b"106 107/// \verbatim108/// Aaa109/// \endverbatim110/// \f$ a \f$111/// \f( b \f)112/// \f[ c \f]113/// \f{env}{ c \f}114int Test_VerbatimBlockComment;115// CHECK: VarDecl{{.*}}Test_VerbatimBlockComment116// CHECK: VerbatimBlockComment{{.*}} Name="verbatim" CloseName="endverbatim"117// CHECK-NEXT: VerbatimBlockLineComment{{.*}} Text=" Aaa"118// CHECK: VerbatimBlockComment{{.*}} Name="f$" CloseName="f$"119// CHECK-NEXT: VerbatimBlockLineComment{{.*}} Text=" a "120// CHECK: VerbatimBlockComment{{.*}} Name="f(" CloseName="f)"121// CHECK-NEXT: VerbatimBlockLineComment{{.*}} Text=" b "122// CHECK: VerbatimBlockComment{{.*}} Name="f[" CloseName="f]"123// CHECK-NEXT: VerbatimBlockLineComment{{.*}} Text=" c "124// CHECK: VerbatimBlockComment{{.*}} Name="f{" CloseName="f}"125// CHECK-NEXT: VerbatimBlockLineComment{{.*}} Text="env}{ c "126 127/// \param ... More arguments128template<typename T>129void Test_TemplatedFunctionVariadic(int arg, ...);130// CHECK: FunctionTemplateDecl{{.*}}Test_TemplatedFunctionVariadic131// CHECK: ParamCommandComment{{.*}} [in] implicitly Param="..."132// CHECK-NEXT: ParagraphComment133// CHECK-NEXT: TextComment{{.*}} Text=" More arguments"134 135/// \param[out] Aaa <summary>Short summary</summary>136int Test_HTMLSummaryTag(int Aaa);137// CHECK: FunctionDecl{{.*}}Test_HTMLSummaryTag138// CHECK: ParamCommandComment{{.*}} [out] explicitly Param="Aaa"139// CHECK-NEXT: ParagraphComment140// CHECK: HTMLStartTagComment{{.*}} Name="summary"141// CHECK-NEXT: TextComment{{.*}} Text="Short summary"142// CHECK-NEXT: HTMLEndTagComment{{.*}} Name="summary"143 144/// \thread_safe test for underscore in special command145int Test_UnderscoreInSpecialCommand;146// CHECK: VarDecl{{.*}}Test_UnderscoreInSpecialCommand 'int'147// CHECK: InlineCommandComment{{.*}} Name="thread_safe" RenderNormal148// CHECK-NEXT: TextComment{{.*}} Text=" test for underscore in special command"149 150/// <details>151/// <summary>152/// Summary153/// </summary>154/// <p>Details</p>155/// </details>156///157/// Some <mark>highlighting</mark>158///159/// <figure>160/// <img src="pic.jpg">161/// <figcaption>Figure 1</figcaption>162/// </figure>163int Test_AdditionalHTMLTags(int Aaa);164// CHECK: FunctionDecl{{.*}}Test_AdditionalHTMLTags 'int (int)'165// CHECK: HTMLStartTagComment{{.*}} Name="details"166// CHECK: HTMLStartTagComment{{.*}} Name="summary"167// CHECK-NEXT: TextComment{{.*}} Text=" Summary"168// CHECK: HTMLEndTagComment{{.*}} Name="summary"169// CHECK: HTMLStartTagComment{{.*}} Name="p"170// CHECK-NEXT: TextComment{{.*}} Text="Details"171// CHECK-NEXT: HTMLEndTagComment{{.*}} Name="p"172// CHECK: HTMLEndTagComment{{.*}} Name="details"173// CHECK: HTMLStartTagComment{{.*}} Name="mark"174// CHECK-NEXT: TextComment{{.*}} Text="highlighting"175// CHECK-NEXT: HTMLEndTagComment{{.*}} Name="mark"176// CHECK: HTMLStartTagComment{{.*}} Name="figure"177// CHECK: HTMLStartTagComment{{.*}} Name="img" Attrs: "src="pic.jpg"178// CHECK: HTMLStartTagComment{{.*}} Name="figcaption"179// CHECK-NEXT: TextComment{{.*}} Text="Figure 1"180// CHECK-NEXT: HTMLEndTagComment{{.*}} Name="figcaption"181// CHECK: HTMLEndTagComment{{.*}} Name="figure"182