1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wdocumentation -Wdocumentation-pedantic -verify %s
2 // RUN: %clang_cc1 -std=c++14 -fsyntax-only -Wdocumentation -Wdocumentation-pedantic -verify %s
3 
4 // This file contains lots of corner cases, so ensure that XML we generate is not invalid.
5 // RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s | FileCheck %s -check-prefix=WRONG
6 // WRONG-NOT: CommentXMLInvalid
7 
8 // expected-warning@+2 {{HTML tag 'a' requires an end tag}}
9 // expected-warning@+1 {{expected quoted string after equals sign}}
10 /// <a href=>
11 int test_html1(int);
12 
13 // expected-warning@+2 {{HTML tag 'a' requires an end tag}}
14 // expected-warning@+1 {{expected quoted string after equals sign}}
15 /// <a href==>
16 int test_html2(int);
17 
18 // expected-warning@+3 {{HTML tag 'a' requires an end tag}}
19 // expected-warning@+2 {{expected quoted string after equals sign}}
20 // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
21 /// <a href= blah
22 int test_html3(int);
23 
24 // expected-warning@+2 {{HTML tag 'a' requires an end tag}}
25 // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
26 /// <a =>
27 int test_html4(int);
28 
29 // expected-warning@+2 {{HTML tag 'a' requires an end tag}}
30 // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
31 /// <a "aaa">
32 int test_html5(int);
33 
34 // expected-warning@+2 {{HTML tag 'a' requires an end tag}}
35 // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
36 /// <a a="b" =>
37 int test_html6(int);
38 
39 // expected-warning@+2 {{HTML tag 'a' requires an end tag}}
40 // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
41 /// <a a="b" "aaa">
42 int test_html7(int);
43 
44 // expected-warning@+2 {{HTML tag 'a' requires an end tag}}
45 // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
46 /// <a a="b" =
47 int test_html8(int);
48 
49 // expected-warning@+2 {{HTML start tag prematurely ended, expected attribute name or '>'}} expected-note@+1 {{HTML tag started here}}
50 /** Aaa bbb<img ddd eee
51  * fff ggg.
52  */
53 int test_html9(int);
54 
55 // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
56 /** Aaa bbb<img ddd eee 42%
57  * fff ggg.
58  */
59 int test_html10(int);
60 
61 // expected-warning@+1 {{HTML end tag 'br' is forbidden}}
62 /// <br></br>
63 int test_html11(int);
64 
65 /// <blockquote>Meow</blockquote>
66 int test_html_nesting1(int);
67 
68 /// <b><i>Meow</i></b>
69 int test_html_nesting2(int);
70 
71 /// <p>Aaa<br>
72 /// Bbb</p>
73 int test_html_nesting3(int);
74 
75 /// <p>Aaa<br />
76 /// Bbb</p>
77 int test_html_nesting4(int);
78 
79 // expected-warning@+3 {{HTML tag 'b' requires an end tag}}
80 // expected-warning@+2 {{HTML tag 'i' requires an end tag}}
81 // expected-warning@+1 {{HTML end tag does not match any start tag}}
82 /// <b><i>Meow</a>
83 int test_html_nesting5(int);
84 
85 // expected-warning@+2 {{HTML start tag 'i' closed by 'b'}}
86 // expected-warning@+1 {{HTML end tag does not match any start tag}}
87 /// <b><i>Meow</b></b>
88 int test_html_nesting6(int);
89 
90 // expected-warning@+2 {{HTML start tag 'i' closed by 'b'}}
91 // expected-warning@+1 {{HTML end tag does not match any start tag}}
92 /// <b><i>Meow</b></i>
93 int test_html_nesting7(int);
94 
95 // expected-warning@+1 {{HTML tag 'b' requires an end tag}}
96 /// <b>Meow
97 int test_html_nesting8(int);
98 
99 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
100 /// \brief\returns Aaa
101 int test_block_command1(int);
102 
103 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
104 /// \brief \returns Aaa
105 int test_block_command2(int);
106 
107 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
108 /// \brief
109 /// \returns Aaa
110 int test_block_command3(int);
111 
112 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
113 /// \brief
114 ///
115 /// \returns Aaa
116 int test_block_command4(int);
117 
118 // There is trailing whitespace on one of the following lines, don't remove it!
119 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
120 /// \brief
121 ///
122 /// \returns Aaa
123 int test_block_command5(int);
124 
125 /// \brief \c Aaa
126 int test_block_command6(int);
127 
128 // expected-warning@+5 {{duplicated command '\brief'}} expected-note@+1 {{previous command '\brief' here}}
129 /// \brief Aaa
130 ///
131 /// Bbb
132 ///
133 /// \brief Ccc
134 int test_duplicate_brief1(int);
135 
136 // expected-warning@+5 {{duplicated command '\short'}} expected-note@+1 {{previous command '\short' here}}
137 /// \short Aaa
138 ///
139 /// Bbb
140 ///
141 /// \short Ccc
142 int test_duplicate_brief2(int);
143 
144 // expected-warning@+5 {{duplicated command '\brief'}} expected-note@+1 {{previous command '\short' (an alias of '\brief') here}}
145 /// \short Aaa
146 ///
147 /// Bbb
148 ///
149 /// \brief Ccc
150 int test_duplicate_brief3(int);
151 
152 
153 /// \return Aaa
154 ///
155 /// Bbb
156 ///
157 /// \return Ccc
158 int test_multiple_returns1(int);
159 
160 /// \returns Aaa
161 ///
162 /// Bbb
163 ///
164 /// \returns Ccc
165 int test_multiple_returns2(int);
166 
167 /// \result Aaa
168 ///
169 /// Bbb
170 ///
171 /// \result Ccc
172 int test_multiple_returns3(int);
173 
174 /// \returns Aaa
175 ///
176 /// Bbb
177 ///
178 /// \return Ccc
179 int test_multiple_returns4(int);
180 
181 
182 // expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
183 /// \param a Blah blah.
184 int test_param1_backslash;
185 
186 // rdar://13066276
187 // Check that the diagnostic uses the same command marker as the comment.
188 // expected-warning@+1 {{'@param' command used in a comment that is not attached to a function declaration}}
189 /// @param a Blah blah.
190 int test_param1_at;
191 
192 // expected-warning@+1 {{empty paragraph passed to '\param' command}}
193 /// \param
194 /// \param a Blah blah.
195 int test_param2(int a);
196 
197 // expected-warning@+1 {{empty paragraph passed to '\param' command}}
198 /// \param a
199 int test_param3(int a);
200 
201 /// \param a Blah blah.
202 int test_param4(int a);
203 
204 /// \param [in] a Blah blah.
205 int test_param5(int a);
206 
207 /// \param [out] a Blah blah.
208 int test_param6(int a);
209 
210 /// \param [in,out] a Blah blah.
211 int test_param7(int a);
212 
213 // expected-warning@+1 {{whitespace is not allowed in parameter passing direction}}
214 /// \param [ in ] a Blah blah.
215 int test_param8(int a);
216 
217 // expected-warning@+1 {{whitespace is not allowed in parameter passing direction}}
218 /// \param [in, out] a Blah blah.
219 int test_param9(int a);
220 
221 // expected-warning@+1 {{unrecognized parameter passing direction, valid directions are '[in]', '[out]' and '[in,out]'}}
222 /// \param [ junk] a Blah blah.
223 int test_param10(int a);
224 
225 // expected-warning@+1 {{parameter 'a' not found in the function declaration}}
226 /// \param a Blah blah.
227 int test_param11();
228 
229 // expected-warning@+1 {{parameter 'A' not found in the function declaration}} expected-note@+1 {{did you mean 'a'?}}
230 /// \param A Blah blah.
231 int test_param12(int a);
232 
233 // expected-warning@+1 {{parameter 'aab' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
234 /// \param aab Blah blah.
235 int test_param13(int aaa, int bbb);
236 
237 // expected-warning@+2 {{parameter 'aab' not found in the function declaration}} expected-note@+2 {{did you mean 'bbb'?}}
238 /// \param aaa Blah blah.
239 /// \param aab Blah blah.
240 int test_param14(int aaa, int bbb);
241 
242 // expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
243 /// \param aab Blah blah.
244 int test_param15(int bbb, int ccc);
245 
246 // expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
247 /// \param aab Ccc.
248 /// \param aaa Aaa.
249 /// \param bbb Bbb.
250 int test_param16(int aaa, int bbb);
251 
252 // expected-warning@+2 {{parameter 'aab' not found in the function declaration}}
253 /// \param aaa Aaa.
254 /// \param aab Ccc.
255 /// \param bbb Bbb.
256 int test_param17(int aaa, int bbb);
257 
258 // expected-warning@+3 {{parameter 'aab' not found in the function declaration}}
259 /// \param aaa Aaa.
260 /// \param bbb Bbb.
261 /// \param aab Ccc.
262 int test_param18(int aaa, int bbb);
263 
264 class C {
265   // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}}
266   /// \param aaa Blah blah.
267   C(int bbb, int ccc);
268 
269   // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}}
270   /// \param aaa Blah blah.
271  int test_param19(int bbb, int ccc);
272 };
273 
274 // expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
275 /// \param aab Blah blah.
276 template<typename T>
277 void test_param20(int bbb, int ccc);
278 
279 // expected-warning@+3 {{parameter 'a' is already documented}}
280 // expected-note@+1 {{previous documentation}}
281 /// \param a Aaa.
282 /// \param a Aaa.
283 int test_param21(int a);
284 
285 // expected-warning@+4 {{parameter 'x2' is already documented}}
286 // expected-note@+2 {{previous documentation}}
287 /// \param x1 Aaa.
288 /// \param x2 Bbb.
289 /// \param x2 Ccc.
290 int test_param22(int x1, int x2, int x3);
291 
292 // expected-warning@+1 {{empty paragraph passed to '\param' command}}
293 /// \param a
294 /// \retval 0 Blah blah.
295 int test_param23(int a);
296 
297 //===---
298 // Test that we treat typedefs to some non-function types as functions for the
299 // purposes of documentation comment parsing.
300 //===---
301 
302 namespace foo {
303   inline namespace bar {
304     template<typename>
305     struct function_wrapper {};
306 
307     template<unsigned>
308     struct not_a_function_wrapper {};
309   }
310 };
311 
312 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
313 /// \param aaa Meow.
314 /// \param bbb Bbb.
315 /// \returns aaa.
316 typedef int test_function_like_typedef1(int aaa, int ccc);
317 
318 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
319 /// \param aaa Meow.
320 /// \param bbb Bbb.
321 /// \returns aaa.
322 typedef int (*test_function_like_typedef2)(int aaa, int ccc);
323 
324 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
325 /// \param aaa Meow.
326 /// \param bbb Bbb.
327 /// \returns aaa.
328 typedef int (* const test_function_like_typedef3)(int aaa, int ccc);
329 
330 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
331 /// \param aaa Meow.
332 /// \param bbb Bbb.
333 /// \returns aaa.
334 typedef int (C::*test_function_like_typedef4)(int aaa, int ccc);
335 
336 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
337 /// \param aaa Meow.
338 /// \param bbb Bbb.
339 /// \returns aaa.
340 typedef foo::function_wrapper<int (int aaa, int ccc)> test_function_like_typedef5;
341 
342 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
343 /// \param aaa Meow.
344 /// \param bbb Bbb.
345 /// \returns aaa.
346 typedef foo::function_wrapper<int (int aaa, int ccc)> *test_function_like_typedef6;
347 
348 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
349 /// \param aaa Meow.
350 /// \param bbb Bbb.
351 /// \returns aaa.
352 typedef foo::function_wrapper<int (int aaa, int ccc)> &test_function_like_typedef7;
353 
354 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
355 /// \param aaa Meow.
356 /// \param bbb Bbb.
357 /// \returns aaa.
358 typedef foo::function_wrapper<int (int aaa, int ccc)> &&test_function_like_typedef8;
359 
360 
361 typedef int (*test_not_function_like_typedef1)(int aaa);
362 
363 // expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
364 /// \param aaa Meow.
365 typedef test_not_function_like_typedef1 test_not_function_like_typedef2;
366 
367 // rdar://13066276
368 // Check that the diagnostic uses the same command marker as the comment.
369 // expected-warning@+1 {{'@param' command used in a comment that is not attached to a function declaration}}
370 /// @param aaa Meow.
371 typedef unsigned int test_not_function_like_typedef3;
372 
373 // expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
374 /// \param aaa Meow.
375 typedef foo::not_a_function_wrapper<1> test_not_function_like_typedef4;
376 
377 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
378 /// \param aaa Meow.
379 /// \param bbb Bbb.
380 /// \returns aaa.
381 using test_function_like_using1 = int (int aaa, int ccc);
382 
383 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
384 /// \param aaa Meow.
385 /// \param bbb Bbb.
386 /// \returns aaa.
387 using test_function_like_using2 = int (*)(int aaa, int ccc);
388 
389 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
390 /// \param aaa Meow.
391 /// \param bbb Bbb.
392 /// \returns aaa.
393 using test_function_like_using3 = int (* const)(int aaa, int ccc);
394 
395 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
396 /// \param aaa Meow.
397 /// \param bbb Bbb.
398 /// \returns aaa.
399 using test_function_like_using4 = int (C::*)(int aaa, int ccc);
400 
401 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
402 /// \param aaa Meow.
403 /// \param bbb Bbb.
404 /// \returns aaa.
405 using test_function_like_using5 = foo::function_wrapper<int (int aaa, int ccc)>;
406 
407 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
408 /// \param aaa Meow.
409 /// \param bbb Bbb.
410 /// \returns aaa.
411 using test_function_like_using6 = foo::function_wrapper<int (int aaa, int ccc)> *;
412 
413 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
414 /// \param aaa Meow.
415 /// \param bbb Bbb.
416 /// \returns aaa.
417 using test_function_like_using7 = foo::function_wrapper<int (int aaa, int ccc)> &;
418 
419 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
420 /// \param aaa Meow.
421 /// \param bbb Bbb.
422 /// \returns aaa.
423 using test_function_like_using8 = foo::function_wrapper<int (int aaa, int ccc)> &&;
424 
425 // expected-warning@+4 {{template parameter 'U' not found in the template declaration}} expected-note@+4 {{did you mean 'T'?}}
426 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
427 /// \param aaa Meow.
428 /// \param bbb Bbb.
429 /// \tparam U Uuu.
430 template<typename T>
431 using test_function_like_using9 = int(T aaa, int ccc);
432 
433 // expected-warning@+4 {{template parameter 'U' not found in the template declaration}} expected-note@+4 {{did you mean 'T'?}}
434 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
435 /// \param aaa Meow.
436 /// \param bbb Bbb.
437 /// \tparam U Uuu.
438 template<typename T>
439 using test_function_like_using10 = int (*)(T aaa, int ccc);
440 
441 // expected-warning@+4 {{template parameter 'U' not found in the template declaration}} expected-note@+4 {{did you mean 'T'?}}
442 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
443 /// \param aaa Meow.
444 /// \param bbb Bbb.
445 /// \tparam U Uuu.
446 template<typename T>
447 using test_function_like_using11 = foo::function_wrapper<int (T aaa, int ccc)>;
448 
449 // expected-warning@+4 {{template parameter 'U' not found in the template declaration}} expected-note@+4 {{did you mean 'T'?}}
450 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
451 /// \param aaa Meow.
452 /// \param bbb Bbb.
453 /// \tparam U Uuu.
454 template<typename T>
455 using test_function_like_using12 = foo::function_wrapper<int (T aaa, int ccc)> *;
456 
457 using test_not_function_like_using1 = int (*)(int aaa);
458 
459 // expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
460 /// \param aaa Meow.
461 using test_not_function_like_using2 = test_not_function_like_using1;
462 
463 // Check that the diagnostic uses the same command marker as the comment.
464 // expected-warning@+1 {{'@param' command used in a comment that is not attached to a function declaration}}
465 /// @param aaa Meow.
466 using test_not_function_like_using3 = unsigned int;
467 
468 // expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
469 /// \param aaa Meow.
470 using test_not_function_like_using4 = foo::not_a_function_wrapper<1>;
471 
472 /// \param aaa Aaa
473 /// \param ... Vararg
474 int test_vararg_param1(int aaa, ...);
475 
476 /// \param ... Vararg
477 int test_vararg_param2(...);
478 
479 // expected-warning@+1 {{parameter '...' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
480 /// \param ... Vararg
481 int test_vararg_param3(int aaa);
482 
483 // expected-warning@+1 {{parameter '...' not found in the function declaration}}
484 /// \param ... Vararg
485 int test_vararg_param4();
486 
487 
488 /// \param aaa Aaa
489 /// \param ... Vararg
490 template<typename T>
491 int test_template_vararg_param1(int aaa, ...);
492 
493 /// \param ... Vararg
494 template<typename T>
495 int test_template_vararg_param2(...);
496 
497 // expected-warning@+1 {{parameter '...' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
498 /// \param ... Vararg
499 template<typename T>
500 int test_template_vararg_param3(int aaa);
501 
502 // expected-warning@+1 {{parameter '...' not found in the function declaration}}
503 /// \param ... Vararg
504 template<typename T>
505 int test_template_vararg_param4();
506 
507 
508 // expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
509 /// \tparam T Aaa
510 int test_tparam1;
511 
512 // expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
513 /// \tparam T Aaa
514 void test_tparam2(int aaa);
515 
516 // expected-warning@+1 {{empty paragraph passed to '\tparam' command}}
517 /// \tparam
518 /// \param aaa Blah blah
519 template<typename T>
520 void test_tparam3(T aaa);
521 
522 // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TT'?}}
523 /// \tparam T Aaa
524 template<typename TT>
525 void test_tparam4(TT aaa);
526 
527 // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TT'?}}
528 /// \tparam T Aaa
529 template<typename TT>
530 class test_tparam5 {
531   // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TTT'?}}
532   /// \tparam T Aaa
533   template<typename TTT>
534   void test_tparam6(TTT aaa);
535 };
536 
537 /// \tparam T1 Aaa
538 /// \tparam T2 Bbb
539 template<typename T1, typename T2>
540 void test_tparam7(T1 aaa, T2 bbb);
541 
542 // expected-warning@+1 {{template parameter 'SomTy' not found in the template declaration}} expected-note@+1 {{did you mean 'SomeTy'?}}
543 /// \tparam SomTy Aaa
544 /// \tparam OtherTy Bbb
545 template<typename SomeTy, typename OtherTy>
546 void test_tparam8(SomeTy aaa, OtherTy bbb);
547 
548 // expected-warning@+2 {{template parameter 'T1' is already documented}} expected-note@+1 {{previous documentation}}
549 /// \tparam T1 Aaa
550 /// \tparam T1 Bbb
551 template<typename T1, typename T2>
552 void test_tparam9(T1 aaa, T2 bbb);
553 
554 /// \tparam T Aaa
555 /// \tparam TT Bbb
556 template<template<typename T> class TT>
557 void test_tparam10(TT<int> aaa);
558 
559 /// \tparam T Aaa
560 /// \tparam TT Bbb
561 /// \tparam TTT Ccc
562 template<template<template<typename T> class TT, class C> class TTT>
563 void test_tparam11();
564 
565 /// \tparam I Aaa
566 template<int I>
567 void test_tparam12();
568 
569 template<typename T, typename U>
570 class test_tparam13 { };
571 
572 /// \tparam T Aaa
573 template<typename T>
574 using test_tparam14 = test_tparam13<T, int>;
575 
576 // expected-warning@+1 {{template parameter 'U' not found in the template declaration}} expected-note@+1 {{did you mean 'T'?}}
577 /// \tparam U Aaa
578 template<typename T>
579 using test_tparam15 = test_tparam13<T, int>;
580 
581 // ----
582 
583 /// \tparam T Aaa
584 template<typename T>
585 class test_tparam16 { };
586 
587 typedef test_tparam16<int> test_tparam17;
588 typedef test_tparam16<double> test_tparam18;
589 
590 // ----
591 
592 template<typename T>
593 class test_tparam19;
594 
595 typedef test_tparam19<int> test_tparam20;
596 typedef test_tparam19<double> test_tparam21;
597 
598 /// \tparam T Aaa
599 template<typename T>
600 class test_tparam19 { };
601 
602 // ----
603 
604 // expected-warning@+1 {{'@tparam' command used in a comment that is not attached to a template declaration}}
605 /// @tparam T Aaa
606 int test_tparam22;
607 
608 // ----
609 
610 
611 /// Aaa
612 /// \deprecated Bbb
613 void test_deprecated_1(int a) __attribute__((deprecated));
614 
615 #if __cplusplus >= 201402L
616 /// Aaa
617 /// \deprecated Bbb
618 [[deprecated]] void test_deprecated_no_warning_std14(int a);
619 #endif
620 
621 // We don't want \deprecated to warn about empty paragraph.  It is fine to use
622 // \deprecated by itself without explanations.
623 
624 /// Aaa
625 /// \deprecated
626 void test_deprecated_2(int a) __attribute__((deprecated));
627 
628 /// Aaa
629 /// \deprecated
630 void test_deprecated_3(int a) __attribute__((availability(macosx,introduced=10.4)));
631 
632 /// Aaa
633 /// \deprecated
634 void test_deprecated_4(int a) __attribute__((unavailable));
635 
636 // expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+3 {{add a deprecation attribute to the declaration to silence this warning}}
637 /// Aaa
638 /// \deprecated
639 void test_deprecated_5(int a);
640 
641 // expected-warning@+2 {{declaration is marked with '@deprecated' command but does not have a deprecation attribute}} expected-note@+3 {{add a deprecation attribute to the declaration to silence this warning}}
642 /// Aaa
643 /// @deprecated
644 void test_deprecated_6(int a) {
645 }
646 
647 // expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
648 /// Aaa
649 /// \deprecated
650 template<typename T>
651 void test_deprecated_7(T aaa);
652 
653 class PR43753 {
654   // expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
655   // expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}}
656   /// \deprecated
657   static void test_deprecated_static();
658 
659   // expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
660   // expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}}
661   /// \deprecated
662   static auto test_deprecated_static_trailing_return() -> int;
663 
664 #if __cplusplus >= 201402L
665   // expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
666   // expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}}
667   /// \deprecated
668   static decltype(auto) test_deprecated_static_decltype_auto() { return 1; }
669 #endif
670 
671   // expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
672   // expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}}
673   /// \deprecated
674   void test_deprecated_const() const;
675 
676   // expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
677   // expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}}
678   /// \deprecated
679   auto test_deprecated_trailing_return() -> int;
680 
681 #if __cplusplus >= 201402L
682   // expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
683   // expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}}
684   /// \deprecated
685   decltype(auto) test_deprecated_decltype_auto() const { return a; }
686 
687 private:
688   int a{0};
689 #endif
690 };
691 
692 // rdar://12397511
693 // expected-note@+2 {{previous command '\headerfile' here}}
694 // expected-warning@+2 {{duplicated command '\headerfile'}}
695 /// \headerfile ""
696 /// \headerfile foo.h
697 int test__headerfile_1(int a);
698 
699 
700 /// \invariant aaa
701 void test_invariant_1(int a);
702 
703 // expected-warning@+1 {{empty paragraph passed to '\invariant' command}}
704 /// \invariant
705 void test_invariant_2(int a);
706 
707 
708 // no-warning
709 /// \returns Aaa
710 int test_returns_right_decl_1(int);
711 
712 class test_returns_right_decl_2 {
713   // no-warning
714   /// \returns Aaa
715   int test_returns_right_decl_3(int);
716 };
717 
718 // no-warning
719 /// \returns Aaa
720 template<typename T>
721 int test_returns_right_decl_4(T aaa);
722 
723 // no-warning
724 /// \returns Aaa
725 template<>
726 int test_returns_right_decl_4(int aaa);
727 
728 /// \returns Aaa
729 template<typename T>
730 T test_returns_right_decl_5(T aaa);
731 
732 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
733 /// \returns Aaa
734 int test_returns_wrong_decl_1_backslash;
735 
736 // rdar://13066276
737 // Check that the diagnostic uses the same command marker as the comment.
738 // expected-warning@+1 {{'@returns' command used in a comment that is not attached to a function or method declaration}}
739 /// @returns Aaa
740 int test_returns_wrong_decl_1_at;
741 
742 // expected-warning@+1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
743 /// \return Aaa
744 int test_returns_wrong_decl_2;
745 
746 // expected-warning@+1 {{'\result' command used in a comment that is not attached to a function or method declaration}}
747 /// \result Aaa
748 int test_returns_wrong_decl_3;
749 
750 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
751 /// \returns Aaa
752 void test_returns_wrong_decl_4(int);
753 
754 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
755 /// \returns Aaa
756 template<typename T>
757 void test_returns_wrong_decl_5(T aaa);
758 
759 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
760 /// \returns Aaa
761 template<>
762 void test_returns_wrong_decl_5(int aaa);
763 
764 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
765 /// \returns Aaa
766 struct test_returns_wrong_decl_6 { };
767 
768 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
769 /// \returns Aaa
770 class test_returns_wrong_decl_7 {
771   // expected-warning@+1 {{'\returns' command used in a comment that is attached to a constructor}}
772   /// \returns Aaa
773   test_returns_wrong_decl_7();
774 
775   // expected-warning@+1 {{'\returns' command used in a comment that is attached to a destructor}}
776   /// \returns Aaa
777   ~test_returns_wrong_decl_7();
778 };
779 
780 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
781 /// \returns Aaa
782 enum test_returns_wrong_decl_8 {
783   // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
784   /// \returns Aaa
785   test_returns_wrong_decl_9
786 };
787 
788 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
789 /// \returns Aaa
790 namespace test_returns_wrong_decl_10 { };
791 
792 // rdar://13094352
793 // expected-warning@+1 {{'@function' command should be used in a comment attached to a function declaration}}
794 /*!	@function test_function
795 */
796 typedef unsigned int Base64Flags;
797 unsigned test_function(Base64Flags inFlags);
798 
799 // expected-warning@+1 {{'@callback' command should be used in a comment attached to a pointer to function declaration}}
800 /*! @callback test_callback
801 */
802 typedef unsigned int BaseFlags;
803 unsigned (*test_callback)(BaseFlags inFlags);
804 
805 // expected-warning@+1 {{'\endverbatim' command does not terminate a verbatim text block}}
806 /// \endverbatim
807 int test_verbatim_1();
808 
809 // expected-warning@+1 {{'\endcode' command does not terminate a verbatim text block}}
810 /// \endcode
811 int test_verbatim_2();
812 
813 // FIXME: we give a bad diagnostic here because we throw away non-documentation
814 // comments early.
815 //
816 // expected-warning@+3 {{'\endcode' command does not terminate a verbatim text block}}
817 /// \code
818 //  foo
819 /// \endcode
820 int test_verbatim_3();
821 
822 
823 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
824 int test1; ///< \brief\author Aaa
825 
826 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
827 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
828 int test2, ///< \brief\author Aaa
829     test3; ///< \brief\author Aaa
830 
831 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
832 int test4; ///< \brief
833            ///< \author Aaa
834 
835 
836 class TestRelates {};
837 
838 /// \relates TestRelates
839 /// \brief Aaa
840 void test_relates_1();
841 
842 /// \related TestRelates
843 /// \brief Aaa
844 void test_relates_2();
845 
846 /// \relatesalso TestRelates
847 /// \brief Aaa
848 void test_relates_3();
849 
850 /// \relatedalso TestRelates
851 /// \brief Aaa
852 void test_relates_4();
853 
854 
855 // Check that we attach the comment to the declaration during parsing in the
856 // following cases.  The test is based on the fact that we don't parse
857 // documentation comments that are not attached to anything.
858 
859 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
860 /// \brief\author Aaa
861 int test_attach1;
862 
863 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
864 /// \brief\author Aaa
865 int test_attach2(int);
866 
867 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
868 /// \brief\author Aaa
869 struct test_attach3 {
870   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
871   /// \brief\author Aaa
872   int test_attach4;
873 
874   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
875   int test_attach5; ///< \brief\author Aaa
876 
877   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
878   /// \brief\author Aaa
879   int test_attach6(int);
880 };
881 
882 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
883 /// \brief\author Aaa
884 class test_attach7 {
885   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
886   /// \brief\author Aaa
887   int test_attach8;
888 
889   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
890   int test_attach9; ///< \brief\author Aaa
891 
892   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
893   /// \brief\author Aaa
894   int test_attach10(int);
895 };
896 
897 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
898 /// \brief\author Aaa
899 enum test_attach9 {
900   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
901   /// \brief\author Aaa
902   test_attach10,
903 
904   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
905   test_attach11 ///< \brief\author Aaa
906 };
907 
908 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
909 /// \brief\author Aaa
910 struct test_noattach12 *test_attach13;
911 
912 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
913 /// \brief\author Aaa
914 typedef struct test_noattach14 *test_attach15;
915 
916 // expected-warning@+1 + {{empty paragraph passed to '\brief' command}}
917 /// \brief\author Aaa
918 typedef struct test_attach16 { int a; } test_attach17;
919 
920 struct S { int a; };
921 
922 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
923 /// \brief\author Aaa
924 struct S *test_attach18;
925 
926 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
927 /// \brief\author Aaa
928 typedef struct S *test_attach19;
929 
930 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
931 /// \brief\author Aaa
932 struct test_attach20;
933 
934 // expected-warning@+1 + {{empty paragraph passed to '\brief' command}}
935 /// \brief\author Aaa
936 typedef struct test_attach21 {
937   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
938   /// \brief\author Aaa
939   int test_attach22;
940 } test_attach23;
941 
942 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
943 /// \brief\author Aaa
944 namespace test_attach24 {
945   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
946   /// \brief\author Aaa
947   namespace test_attach25 {
948   }
949 }
950 
951 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
952 /// \brief\author Aaa
953 /// \tparam T Aaa
954 template<typename T>
955 void test_attach26(T aaa);
956 
957 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
958 /// \brief\author Aaa
959 /// \tparam T Aaa
960 template<typename T, typename U>
961 void test_attach27(T aaa, U bbb);
962 
963 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
964 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
965 /// \brief\author Aaa
966 /// \tparam T Aaa
967 template<>
968 void test_attach27(int aaa, int bbb);
969 
970 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
971 /// \brief\author Aaa
972 /// \tparam T Aaa
973 template<typename T>
974 class test_attach28 {
975   T aaa;
976 };
977 
978 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
979 /// \brief\author Aaa
980 using test_attach29 = test_attach28<int>;
981 
982 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
983 /// \brief\author Aaa
984 /// \tparam T Aaa
985 template<typename T, typename U>
986 class test_attach30 { };
987 
988 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
989 /// \brief\author Aaa
990 /// \tparam T Aaa
991 template<typename T>
992 class test_attach30<T, int> { };
993 
994 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
995 /// \brief\author Aaa
996 template<>
997 class test_attach30<int, int> { };
998 
999 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1000 /// \brief\author Aaa
1001 template<typename T>
1002 using test_attach31 = test_attach30<T, int>;
1003 
1004 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1005 /// \brief\author Aaa
1006 /// \tparam T Aaa
1007 template<typename T, typename U, typename V>
1008 class test_attach32 { };
1009 
1010 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1011 /// \brief\author Aaa
1012 /// \tparam T Aaa
1013 template<typename T, typename U>
1014 class test_attach32<T, U, int> { };
1015 
1016 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1017 /// \brief\author Aaa
1018 /// \tparam T Aaa
1019 template<typename T>
1020 class test_attach32<T, int, int> { };
1021 
1022 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
1023 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
1024 /// \brief\author Aaa
1025 /// \tparam T Aaa
1026 template<>
1027 class test_attach32<int, int, int> { };
1028 
1029 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1030 /// \brief\author Aaa
1031 class test_attach33 {
1032   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1033   /// \brief\author Aaa
1034   /// \tparam T Aaa
1035   template<typename T, typename U>
1036   void test_attach34(T aaa, U bbb);
1037 };
1038 
1039 template<typename T>
1040 class test_attach35 {
1041   // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
1042   // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
1043   /// \brief\author Aaa
1044   /// \tparam T Aaa
1045   template<typename TT, typename UU>
1046   void test_attach36(TT aaa, UU bbb);
1047 };
1048 
1049 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
1050 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
1051 /// \brief\author Aaa
1052 /// \tparam T Aaa
1053 template<> template<>
1054 void test_attach35<int>::test_attach36(int aaa, int bbb) {}
1055 
1056 template<typename T>
1057 class test_attach37 {
1058   // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
1059   // expected-warning@+2 {{'\tparam' command used in a comment that is not attached to a template declaration}}
1060   /// \brief\author Aaa
1061   /// \tparam T Aaa
1062   void test_attach38(int aaa, int bbb);
1063 
1064   void test_attach39(int aaa, int bbb);
1065 };
1066 
1067 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
1068 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
1069 /// \brief\author Aaa
1070 /// \tparam T Aaa
1071 template<>
1072 void test_attach37<int>::test_attach38(int aaa, int bbb) {}
1073 
1074 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1075 /// \brief\author Aaa
1076 /// \tparam T Aaa
1077 template<typename T>
1078 void test_attach37<T>::test_attach39(int aaa, int bbb) {}
1079 
1080 // We used to emit warning that parameter 'a' is not found because we parsed
1081 // the comment in context of the redeclaration which does not have parameter
1082 // names.
1083 template <typename T>
1084 struct test_attach38 {
1085   /*!
1086     \param a  First param
1087     \param b  Second param
1088   */
1089   template <typename B>
1090   void test_attach39(T a, B b);
1091 };
1092 
1093 template <>
1094 template <typename B>
1095 void test_attach38<int>::test_attach39(int, B);
1096 
1097 // The inline comments expect a string after the command.
1098 // expected-warning@+1 {{'\a' command does not have a valid word argument}}
1099 /// \a
1100 int test_inline_no_argument_a_bad(int);
1101 
1102 /// \a A
1103 int test_inline_no_argument_a_good(int);
1104 
1105 // expected-warning@+1 {{'\anchor' command does not have a valid word argument}}
1106 /// \anchor
1107 int test_inline_no_argument_anchor_bad(int);
1108 
1109 /// \anchor A
1110 int test_inline_no_argument_anchor_good(int);
1111 
1112 // expected-warning@+1 {{'@b' command does not have a valid word argument}}
1113 /// @b
1114 int test_inline_no_argument_b_bad(int);
1115 
1116 /// @b A
1117 int test_inline_no_argument_b_good(int);
1118 
1119 // expected-warning@+1 {{'\c' command does not have a valid word argument}}
1120 /// \c
1121 int test_inline_no_argument_c_bad(int);
1122 
1123 /// \c A
1124 int test_inline_no_argument_c_good(int);
1125 
1126 // expected-warning@+1 {{'\e' command does not have a valid word argument}}
1127 /// \e
1128 int test_inline_no_argument_e_bad(int);
1129 
1130 /// \e A
1131 int test_inline_no_argument_e_good(int);
1132 
1133 // expected-warning@+1 {{'\em' command does not have a valid word argument}}
1134 /// \em
1135 int test_inline_no_argument_em_bad(int);
1136 
1137 /// \em A
1138 int test_inline_no_argument_em_good(int);
1139 
1140 // expected-warning@+1 {{'\p' command does not have a valid word argument}}
1141 /// \p
1142 int test_inline_no_argument_p_bad(int);
1143 
1144 /// \p A
1145 int test_inline_no_argument_p_good(int);
1146 
1147 // PR13411, reduced.  We used to crash on this.
1148 /**
1149  * @code Aaa.
1150  */
1151 void test_nocrash1(int);
1152 
1153 // We used to crash on this.
1154 // expected-warning@+2 {{empty paragraph passed to '\param' command}}
1155 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1156 /// \param\brief
1157 void test_nocrash2(int);
1158 
1159 // PR13593, example 1 and 2
1160 
1161 /**
1162 * Bla.
1163 */
1164 template <typename>
1165 void test_nocrash3();
1166 
1167 /// Foo
1168 template <typename, typename>
1169 void test_nocrash4() { }
1170 
1171 template <typename>
1172 void test_nocrash3()
1173 {
1174 }
1175 
1176 // PR13593, example 3
1177 
1178 /**
1179  * aaa
1180  */
1181 template <typename T>
1182 inline T test_nocrash5(T a1)
1183 {
1184     return a1;
1185 }
1186 
1187 ///
1188 //,
1189 
1190 inline void test_nocrash6()
1191 {
1192     test_nocrash5(1);
1193 }
1194 
1195 // We used to crash on this.
1196 
1197 /*!
1198   Blah.
1199 */
1200 typedef const struct test_nocrash7 * test_nocrash8;
1201 
1202 // We used to crash on this.
1203 
1204 // expected-warning@+1 {{unknown command tag name}}
1205 /// aaa \unknown aaa \unknown aaa
1206 int test_nocrash9;
1207 
1208 // We used to crash on this.  PR15068
1209 
1210 // expected-warning@+2 {{empty paragraph passed to '@param' command}}
1211 // expected-warning@+2 {{empty paragraph passed to '@param' command}}
1212 ///@param x
1213 ///@param y
1214 int test_nocrash10(int x, int y);
1215 
1216 // expected-warning@+2 {{empty paragraph passed to '@param' command}} expected-warning@+2 {{parameter 'x' not found in the function declaration}}
1217 // expected-warning@+2 {{empty paragraph passed to '@param' command}} expected-warning@+2 {{parameter 'y' not found in the function declaration}}
1218 ///@param x
1219 ///@param y
1220 int test_nocrash11();
1221 
1222 // expected-warning@+3 {{empty paragraph passed to '@param' command}} expected-warning@+3 {{parameter 'x' not found in the function declaration}}
1223 // expected-warning@+3 {{empty paragraph passed to '@param' command}} expected-warning@+3 {{parameter 'y' not found in the function declaration}}
1224 /**
1225 @param x
1226 @param y
1227 **/
1228 int test_nocrash12();
1229 
1230 // expected-warning@+2 {{empty paragraph passed to '@param' command}}
1231 // expected-warning@+1 {{empty paragraph passed to '@param' command}}
1232 ///@param x@param y
1233 int test_nocrash13(int x, int y);
1234 
1235 /**
1236  * \verbatim
1237  * Aaa
1238  **/
1239 int test_nocrash14();
1240 
1241 // rdar://12379114
1242 // expected-warning@+2 {{'@union' command should not be used in a comment attached to a non-union declaration}}
1243 /*!
1244    @union U This is new
1245 */
1246 struct U { int iS; };
1247 
1248 /*!
1249   @union U1
1250 */
1251 union U1 {int i; };
1252 
1253 // expected-warning@+2 {{'@struct' command should not be used in a comment attached to a non-struct declaration}}
1254 /*!
1255  @struct S2
1256 */
1257 union S2 {};
1258 
1259 /*!
1260   @class C1
1261 */
1262 class C1;
1263 
1264 /*!
1265   @struct S3;
1266 */
1267 class S3;
1268 
1269 // rdar://14124702
1270 //----------------------------------------------------------------------
1271 /// @class Predicate Predicate.h "lldb/Host/Predicate.h"
1272 /// @brief A C++ wrapper class for providing threaded access to a value
1273 /// of type T.
1274 ///
1275 /// A templatized class.
1276 /// specified values.
1277 //----------------------------------------------------------------------
1278 template <class T, class T1>
1279 class Predicate
1280 {
1281 };
1282 
1283 //----------------------------------------------------------------------
1284 /// @class Predicate<int, char> Predicate.h "lldb/Host/Predicate.h"
1285 /// @brief A C++ wrapper class for providing threaded access to a value
1286 /// of type T.
1287 ///
1288 /// A template specialization class.
1289 //----------------------------------------------------------------------
1290 template<> class Predicate<int, char>
1291 {
1292 };
1293 
1294 //----------------------------------------------------------------------
1295 /// @class Predicate<T, int> Predicate.h "lldb/Host/Predicate.h"
1296 /// @brief A C++ wrapper class for providing threaded access to a value
1297 /// of type T.
1298 ///
1299 /// A partial specialization template class.
1300 //----------------------------------------------------------------------
1301 template<class T> class Predicate<T, int>
1302 {
1303 };
1304 
1305 /*!     @function test_function
1306 */
1307 template <class T> T test_function (T arg);
1308 
1309 /*!     @function test_function<int>
1310 */
1311 template <> int test_function<int> (int arg);
1312 
1313 namespace AllowParamAndReturnsOnFunctionPointerVars {
1314 
1315 /**
1316  * functionPointerVariable
1317  *
1318  * @param i is integer.
1319  * @returns integer.
1320  */
1321 int (*functionPointerVariable)(int i);
1322 
1323 struct HasFields {
1324   /**
1325    * functionPointerField
1326    *
1327    * @param i is integer.
1328    * @returns integer.
1329    */
1330   int (*functionPointerField)(int i);
1331 };
1332 
1333 // expected-warning@+5 {{'\returns' command used in a comment that is attached to a function returning void}}
1334 /**
1335  * functionPointerVariable
1336  *
1337  * \param p not here.
1338  * \returns integer.
1339  */
1340 void (*functionPointerVariableThatLeadsNowhere)();
1341 
1342 // Still warn about param/returns commands for variables that don't specify
1343 // the type directly:
1344 
1345 /**
1346  * FunctionPointerTypedef
1347  *
1348  * \param i is integer.
1349  * \returns integer.
1350  */
1351 typedef int (*FunctionPointerTypedef)(int i);
1352 
1353 /**
1354  * FunctionPointerTypealias
1355  *
1356  * \param i is integer.
1357  * \returns integer.
1358  */
1359 using FunctionPointerTypealias = int (*)(int i);
1360 
1361 // expected-warning@+5 {{'@param' command used in a comment that is not attached to a function declaration}}
1362 // expected-warning@+5 {{'@returns' command used in a comment that is not attached to a function or method declaration}}
1363 /**
1364  * functionPointerVariable
1365  *
1366  * @param i is integer.
1367  * @returns integer.
1368  */
1369 FunctionPointerTypedef functionPointerTypedefVariable;
1370 
1371 struct HasMoreFields {
1372   // expected-warning@+5 {{'\param' command used in a comment that is not attached to a function declaration}}
1373   // expected-warning@+5 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
1374   /**
1375    * functionPointerTypealiasField
1376    *
1377    * \param i is integer.
1378    * \returns integer.
1379    */
1380   FunctionPointerTypealias functionPointerTypealiasField;
1381 };
1382 
1383 }
1384 
1385 /*!
1386  * Function pointer typedef with variadic params.
1387  *
1388  * @param a
1389  * works
1390  *
1391  * @param ...
1392  * now should work too.
1393  */
1394 typedef void (*VariadicFnType)(int a, ...);
1395 
1396 /*!
1397  * Function pointer type alias with variadic params.
1398  *
1399  * @param a
1400  * works
1401  *
1402  * @param ...
1403  * now should work too.
1404  */
1405 using VariadicFnType2 = void (*)(int a, ...);
1406 
1407 // expected-warning@+2 {{empty paragraph passed to '@note' command}}
1408 /**
1409 @note
1410 \f$\texttt{mu}_{00}=\texttt{m}_{00}\f$, \f$\texttt{nu}_{00}=1\f$
1411 \f$\texttt{nu}_{10}=\texttt{mu}_{10}=\texttt{mu}_{01}=\texttt{mu}_{10}=0\f$
1412  */
1413 class EmptyNoteNoCrash {
1414 };
1415 
1416 namespace PR42844 { // Assertion failures when using typedefed function pointers
1417 typedef void (*AA)();
1418 typedef AA A();
1419 A *a; ///< \return none
1420 // expected-warning@-1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
1421 
1422 typedef void B();
1423 B *b; ///< \return none
1424 // expected-warning@-1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
1425 
1426 void CC();
1427 typedef void C();
1428 C &c = CC; ///< \return none
1429 // expected-warning@-1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
1430 
1431 using DD = void(*)();
1432 using D = DD();
1433 D *d; ///< \return none
1434 // expected-warning@-1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
1435 
1436 using E = void();
1437 E *e; ///< \return none
1438 // expected-warning@-1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
1439 
1440 void FF();
1441 using F = void();
1442 F &f = FF; ///< \return none
1443 // expected-warning@-1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
1444 
1445 } // namespace PR42844
1446