Skip to content

Commit e113a72

Browse files
authored
[clang-doc] Precommit test case for functions with templated parameters and return
To address #67549 we need a test case that will show up in the markdown output for functions. Reviewers: PeterChou1, petrhosek Reviewed By: petrhosek Pull Request: #119814
1 parent 52e2591 commit e113a72

File tree

1 file changed

+64
-2
lines changed

1 file changed

+64
-2
lines changed

clang-tools-extra/test/clang-doc/templates.cpp

+64-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99

1010
// YAML: ---
1111
// YAML-NEXT: USR: '{{([0-9A-F]{40})}}'
12+
// YAML-NEXT: ChildRecords:
13+
// YAML-NEXT: - Type: Record
14+
// YAML-NEXT: Name: 'tuple'
15+
// YAML-NEXT: QualName: 'tuple'
16+
// YAML-NEXT: USR: '{{([0-9A-F]{40})}}'
17+
// YAML-NEXT: Path: 'GlobalNamespace'
1218

1319
// MD: # Global Namespace
1420
// MD: ## Functions
@@ -87,9 +93,65 @@ void function<bool, 0>(bool x) {}
8793
// YAML-NEXT: Params:
8894
// YAML-NEXT: - Contents: 'bool'
8995
// YAML-NEXT: - Contents: '0'
90-
// YAML-NEXT: ...
9196

9297
// MD: ### function
9398
// MD: *void function(_Bool x)*
94-
// MD: *Defined at {{.*}}templates.cpp#[[# @LINE - 27]]*
99+
// MD: *Defined at {{.*}}templates.cpp#[[# @LINE - 26]]*
100+
101+
/// A Tuple type
102+
///
103+
/// Does Tuple things.
104+
template<typename ...Tys>
105+
struct tuple{};
106+
107+
/// A function with a tuple parameter
108+
///
109+
/// \param t The input to func_with_tuple_param
110+
tuple<int,int,bool> func_with_tuple_param(tuple<int,int,bool> t){ return t;}
111+
112+
// YAML-NEXT: - USR: '{{([0-9A-F]{40})}}'
113+
// YAML-NEXT: Name: 'func_with_tuple_param'
114+
// YAML-NEXT: Description:
115+
// YAML-NEXT: - Kind: 'FullComment'
116+
// YAML-NEXT: Children:
117+
// YAML-NEXT: - Kind: 'ParagraphComment'
118+
// YAML-NEXT: Children:
119+
// YAML-NEXT: - Kind: 'TextComment'
120+
// YAML-NEXT: Text: ' A function with a tuple parameter'
121+
// YAML-NEXT: - Kind: 'ParagraphComment'
122+
// YAML-NEXT: Children:
123+
// YAML-NEXT: - Kind: 'TextComment'
124+
// YAML-NEXT: - Kind: 'ParamCommandComment'
125+
// YAML-NEXT: Direction: '[in]'
126+
// YAML-NEXT: ParamName: 't'
127+
// YAML-NEXT: Children:
128+
// YAML-NEXT: - Kind: 'ParagraphComment'
129+
// YAML-NEXT: Children:
130+
// YAML-NEXT: - Kind: 'TextComment'
131+
// YAML-NEXT: Text: ' The input to func_with_tuple_param'
132+
// YAML-NEXT: DefLocation:
133+
// YAML-NEXT: LineNumber: [[# @LINE - 23]]
134+
// YAML-NEXT: Filename:
135+
// YAML-NEXT: Params:
136+
// YAML-NEXT: - Type:
137+
// YAML-NEXT: Type: Record
138+
// YAML-NEXT: Name: 'tuple'
139+
// YAML-NEXT: QualName: 'tuple<int, int, _Bool>'
140+
// YAML-NEXT: USR: '{{([0-9A-F]{40})}}'
141+
// YAML-NEXT: Path: 'GlobalNamespace'
142+
// YAML-NEXT: Name: 't'
143+
// YAML-NEXT: ReturnType:
144+
// YAML-NEXT: Type:
145+
// YAML-NEXT: Type: Record
146+
// YAML-NEXT: Name: 'tuple'
147+
// YAML-NEXT: QualName: 'tuple<int, int, _Bool>'
148+
// YAML-NEXT: USR: '{{([0-9A-F]{40})}}'
149+
// YAML-NEXT: Path: 'GlobalNamespace'
150+
// YAML-NEXT: ...
151+
152+
// MD: ### func_with_tuple_param
153+
// MD: *tuple func_with_tuple_param(tuple t)*
154+
// MD: *Defined at {{.*}}templates.cpp#[[# @LINE - 44]]*
155+
// MD: A function with a tuple parameter
156+
// MD: **t** The input to func_with_tuple_param
95157

0 commit comments

Comments
 (0)