1 // Without serialization:
2 // RUN: %clang_cc1 -Wdocumentation -ast-dump -ast-dump-filter Test %s \
3 // RUN: | FileCheck -strict-whitespace %s
4 //
5 // With serialization:
6 // RUN: %clang_cc1 -Wdocumentation -emit-pch -o %t %s
7 // 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 %s
10 
11 /// Aaa
12 int TestLocation;
13 // CHECK: VarDecl{{.*}}TestLocation
14 // CHECK-NEXT:   FullComment 0x{{[^ ]*}} <line:[[@LINE-3]]:4, col:7>
15 
16 ///
17 int TestIndent;
18 // CHECK:      {{^VarDecl.*TestIndent[^()]*$}}
19 // CHECK-NEXT: {{^`-FullComment.*>$}}
20 
21 /// Aaa
22 int Test_TextComment;
23 // CHECK:      VarDecl{{.*}}Test_TextComment
24 // CHECK-NEXT:   FullComment
25 // CHECK-NEXT:     ParagraphComment
26 // CHECK-NEXT:       TextComment{{.*}} Text=" Aaa"
27 
28 /// \brief Aaa
29 int Test_BlockCommandComment;
30 // CHECK:      VarDecl{{.*}}Test_BlockCommandComment
31 // CHECK:        BlockCommandComment{{.*}} Name="brief"
32 // CHECK-NEXT:     ParagraphComment
33 // CHECK-NEXT:       TextComment{{.*}} Text=" Aaa"
34 
35 /// \param Aaa xxx
36 /// \param [in,out] Bbb yyy
37 void Test_ParamCommandComment(int Aaa, int Bbb);
38 // CHECK:      FunctionDecl{{.*}}Test_ParamCommandComment
39 // CHECK:        ParamCommandComment{{.*}} [in] implicitly Param="Aaa" ParamIndex=0
40 // CHECK-NEXT:     ParagraphComment
41 // CHECK-NEXT:       TextComment{{.*}} Text=" xxx"
42 // CHECK:        ParamCommandComment{{.*}} [in,out] explicitly Param="Bbb" ParamIndex=1
43 // CHECK-NEXT:     ParagraphComment
44 // CHECK-NEXT:       TextComment{{.*}} Text=" yyy"
45 
46 /// \tparam Aaa xxx
47 template <typename Aaa> class Test_TParamCommandComment;
48 // CHECK:      ClassTemplateDecl{{.*}}Test_TParamCommandComment
49 // CHECK:        TParamCommandComment{{.*}} Param="Aaa" Position=<0>
50 // CHECK-NEXT:     ParagraphComment
51 // CHECK-NEXT:       TextComment{{.*}} Text=" xxx"
52 
53 /// \c Aaa
54 int Test_InlineCommandComment;
55 // CHECK:      VarDecl{{.*}}Test_InlineCommandComment
56 // CHECK:        InlineCommandComment{{.*}} Name="c" RenderMonospaced Arg[0]="Aaa"
57 
58 /// \anchor Aaa
59 int Test_InlineCommandCommentAnchor;
60 // CHECK:      VarDecl{{.*}}Test_InlineCommandComment
61 // CHECK:        InlineCommandComment{{.*}} Name="anchor" RenderAnchor Arg[0]="Aaa"
62 
63 /// <a>Aaa</a>
64 /// <br/>
65 int Test_HTMLTagComment;
66 // CHECK:      VarDecl{{.*}}Test_HTMLTagComment
67 // CHECK-NEXT:   FullComment
68 // CHECK-NEXT:     ParagraphComment
69 // CHECK-NEXT:       TextComment{{.*}} Text=" "
70 // CHECK-NEXT:       HTMLStartTagComment{{.*}} Name="a"
71 // CHECK-NEXT:       TextComment{{.*}} Text="Aaa"
72 // CHECK-NEXT:       HTMLEndTagComment{{.*}} Name="a"
73 // CHECK-NEXT:       TextComment{{.*}} Text=" "
74 // CHECK-NEXT:       HTMLStartTagComment{{.*}} Name="br" SelfClosing
75 
76 /// \verbatim
77 /// Aaa
78 /// \endverbatim
79 int Test_VerbatimBlockComment;
80 // CHECK:      VarDecl{{.*}}Test_VerbatimBlockComment
81 // CHECK:        VerbatimBlockComment{{.*}} Name="verbatim" CloseName="endverbatim"
82 // CHECK-NEXT:     VerbatimBlockLineComment{{.*}} Text=" Aaa"
83 
84 /// \param ... More arguments
85 template<typename T>
86 void Test_TemplatedFunctionVariadic(int arg, ...);
87 // CHECK:      FunctionTemplateDecl{{.*}}Test_TemplatedFunctionVariadic
88 // CHECK:        ParamCommandComment{{.*}} [in] implicitly Param="..."
89 // CHECK-NEXT:     ParagraphComment
90 // CHECK-NEXT:       TextComment{{.*}} Text=" More arguments"
91