[Reland][Runtimes] Merge 'compile_commands.json' files from runtimes build (#116303)
[llvm-project.git] / clang / test / Sema / warn-documentation.cpp
blob4839bdff61795ba9ee06e468371fe4f5d8bfa37b
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
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
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);
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);
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);
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);
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);
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);
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);
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);
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.
53 int test_html9(int);
55 // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
56 /** Aaa bbb<img ddd eee 42%
57 * fff ggg.
59 int test_html10(int);
61 // expected-warning@+1 {{HTML end tag 'br' is forbidden}}
62 /// <br></br>
63 int test_html11(int);
65 /// Aaa bbb<img/>
66 int test_html12(int);
68 /// Aaa bbb<img />
69 int test_html13(int);
71 /// Aaa bbb<img src="">
72 int test_html14(int);
74 /// Aaa bbb<img src=""/>
75 int test_html15(int);
77 /// Aaa bbb<img src="" />
78 int test_html16(int);
80 /// <blockquote>Meow</blockquote>
81 int test_html_nesting1(int);
83 /// <b><i>Meow</i></b>
84 int test_html_nesting2(int);
86 /// <p>Aaa<br>
87 /// Bbb</p>
88 int test_html_nesting3(int);
90 /// <p>Aaa<br />
91 /// Bbb</p>
92 int test_html_nesting4(int);
94 // expected-warning@+3 {{HTML tag 'b' requires an end tag}}
95 // expected-warning@+2 {{HTML tag 'i' requires an end tag}}
96 // expected-warning@+1 {{HTML end tag does not match any start tag}}
97 /// <b><i>Meow</a>
98 int test_html_nesting5(int);
100 // expected-warning@+2 {{HTML start tag 'i' closed by 'b'}}
101 // expected-warning@+1 {{HTML end tag does not match any start tag}}
102 /// <b><i>Meow</b></b>
103 int test_html_nesting6(int);
105 // expected-warning@+2 {{HTML start tag 'i' closed by 'b'}}
106 // expected-warning@+1 {{HTML end tag does not match any start tag}}
107 /// <b><i>Meow</b></i>
108 int test_html_nesting7(int);
110 // expected-warning@+1 {{HTML tag 'b' requires an end tag}}
111 /// <b>Meow
112 int test_html_nesting8(int);
114 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
115 /// \brief\returns Aaa
116 int test_block_command1(int);
118 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
119 /// \brief \returns Aaa
120 int test_block_command2(int);
122 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
123 /// \brief
124 /// \returns Aaa
125 int test_block_command3(int);
127 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
128 /// \brief
130 /// \returns Aaa
131 int test_block_command4(int);
133 // There is trailing whitespace on one of the following lines, don't remove it!
134 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
135 /// \brief
136 ///
137 /// \returns Aaa
138 int test_block_command5(int);
140 /// \brief \c Aaa
141 int test_block_command6(int);
143 // We don't recognize comments in double quotes.
144 /// "\brief \returns Aaa"
145 int test_block_command7(int);
147 // But only if they're single-line. (Doxygen treats multi-line quotes inconsistently.)
148 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
149 /// "\brief
150 /// \returns Aaa"
151 int test_block_command8(int);
153 // expected-warning@+5 {{duplicated command '\brief'}} expected-note@+1 {{previous command '\brief' here}}
154 /// \brief Aaa
156 /// Bbb
158 /// \brief Ccc
159 int test_duplicate_brief1(int);
161 // expected-warning@+5 {{duplicated command '\short'}} expected-note@+1 {{previous command '\short' here}}
162 /// \short Aaa
164 /// Bbb
166 /// \short Ccc
167 int test_duplicate_brief2(int);
169 // expected-warning@+5 {{duplicated command '\brief'}} expected-note@+1 {{previous command '\short' (an alias of '\brief') here}}
170 /// \short Aaa
172 /// Bbb
174 /// \brief Ccc
175 int test_duplicate_brief3(int);
178 /// \return Aaa
180 /// Bbb
182 /// \return Ccc
183 int test_multiple_returns1(int);
185 /// \returns Aaa
187 /// Bbb
189 /// \returns Ccc
190 int test_multiple_returns2(int);
192 /// \result Aaa
194 /// Bbb
196 /// \result Ccc
197 int test_multiple_returns3(int);
199 /// \returns Aaa
201 /// Bbb
203 /// \return Ccc
204 int test_multiple_returns4(int);
207 /// expected-warning@+1 {{empty paragraph passed to '\retval' command}}
208 /// \retval 0
209 int test_retval_no_paragraph();
211 /// \retval 0 Everything is fine.
212 int test_retval_fine();
215 // expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
216 /// \param a Blah blah.
217 int test_param1_backslash;
219 // Check that the diagnostic uses the same command marker as the comment.
220 // expected-warning@+1 {{'@param' command used in a comment that is not attached to a function declaration}}
221 /// @param a Blah blah.
222 int test_param1_at;
224 // expected-warning@+1 {{empty paragraph passed to '\param' command}}
225 /// \param
226 /// \param a Blah blah.
227 int test_param2(int a);
229 // expected-warning@+1 {{empty paragraph passed to '\param' command}}
230 /// \param a
231 int test_param3(int a);
233 /// \param a Blah blah.
234 int test_param4(int a);
236 /// \param [in] a Blah blah.
237 int test_param5(int a);
239 /// \param [out] a Blah blah.
240 int test_param6(int a);
242 /// \param [in,out] a Blah blah.
243 int test_param7(int a);
245 // expected-warning@+1 {{whitespace is not allowed in parameter passing direction}}
246 /// \param [ in ] a Blah blah.
247 int test_param8(int a);
249 // expected-warning@+1 {{whitespace is not allowed in parameter passing direction}}
250 /// \param [in, out] a Blah blah.
251 int test_param9(int a);
253 // expected-warning@+1 {{unrecognized parameter passing direction, valid directions are '[in]', '[out]' and '[in,out]'}}
254 /// \param [ junk] a Blah blah.
255 int test_param10(int a);
257 // expected-warning@+1 {{parameter 'a' not found in the function declaration}}
258 /// \param a Blah blah.
259 int test_param11();
261 // expected-warning@+1 {{parameter 'A' not found in the function declaration}} expected-note@+1 {{did you mean 'a'?}}
262 /// \param A Blah blah.
263 int test_param12(int a);
265 // expected-warning@+1 {{parameter 'aab' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
266 /// \param aab Blah blah.
267 int test_param13(int aaa, int bbb);
269 // expected-warning@+2 {{parameter 'aab' not found in the function declaration}} expected-note@+2 {{did you mean 'bbb'?}}
270 /// \param aaa Blah blah.
271 /// \param aab Blah blah.
272 int test_param14(int aaa, int bbb);
274 // expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
275 /// \param aab Blah blah.
276 int test_param15(int bbb, int ccc);
278 // expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
279 /// \param aab Ccc.
280 /// \param aaa Aaa.
281 /// \param bbb Bbb.
282 int test_param16(int aaa, int bbb);
284 // expected-warning@+2 {{parameter 'aab' not found in the function declaration}}
285 /// \param aaa Aaa.
286 /// \param aab Ccc.
287 /// \param bbb Bbb.
288 int test_param17(int aaa, int bbb);
290 // expected-warning@+3 {{parameter 'aab' not found in the function declaration}}
291 /// \param aaa Aaa.
292 /// \param bbb Bbb.
293 /// \param aab Ccc.
294 int test_param18(int aaa, int bbb);
296 class C {
297 // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}}
298 /// \param aaa Blah blah.
299 C(int bbb, int ccc);
301 // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}}
302 /// \param aaa Blah blah.
303 int test_param19(int bbb, int ccc);
306 // expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
307 /// \param aab Blah blah.
308 template<typename T>
309 void test_param20(int bbb, int ccc);
311 // expected-warning@+3 {{parameter 'a' is already documented}}
312 // expected-note@+1 {{previous documentation}}
313 /// \param a Aaa.
314 /// \param a Aaa.
315 int test_param21(int a);
317 // expected-warning@+4 {{parameter 'x2' is already documented}}
318 // expected-note@+2 {{previous documentation}}
319 /// \param x1 Aaa.
320 /// \param x2 Bbb.
321 /// \param x2 Ccc.
322 int test_param22(int x1, int x2, int x3);
324 // expected-warning@+1 {{empty paragraph passed to '\param' command}}
325 /// \param a
326 /// \retval 0 Blah blah.
327 int test_param23(int a);
329 /// \param a \ref test_param23 has an empty paragraph, this doesn't.
330 int test_param24(int a);
332 //===---
333 // Test that we treat typedefs to some non-function types as functions for the
334 // purposes of documentation comment parsing.
335 //===---
337 namespace foo {
338 inline namespace bar {
339 template<typename>
340 struct function_wrapper {};
342 template<unsigned>
343 struct not_a_function_wrapper {};
347 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
348 /// \param aaa Meow.
349 /// \param bbb Bbb.
350 /// \returns aaa.
351 typedef int test_function_like_typedef1(int aaa, int ccc);
353 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
354 /// \param aaa Meow.
355 /// \param bbb Bbb.
356 /// \returns aaa.
357 typedef int (*test_function_like_typedef2)(int aaa, int ccc);
359 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
360 /// \param aaa Meow.
361 /// \param bbb Bbb.
362 /// \returns aaa.
363 typedef int (* const test_function_like_typedef3)(int aaa, int ccc);
365 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
366 /// \param aaa Meow.
367 /// \param bbb Bbb.
368 /// \returns aaa.
369 typedef int (C::*test_function_like_typedef4)(int aaa, int ccc);
371 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
372 /// \param aaa Meow.
373 /// \param bbb Bbb.
374 /// \returns aaa.
375 typedef foo::function_wrapper<int (int aaa, int ccc)> test_function_like_typedef5;
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 typedef foo::function_wrapper<int (int aaa, int ccc)> *test_function_like_typedef6;
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 typedef foo::function_wrapper<int (int aaa, int ccc)> &test_function_like_typedef7;
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 typedef foo::function_wrapper<int (int aaa, int ccc)> &&test_function_like_typedef8;
396 typedef int (*test_not_function_like_typedef1)(int aaa);
398 // expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
399 /// \param aaa Meow.
400 typedef test_not_function_like_typedef1 test_not_function_like_typedef2;
402 // Check that the diagnostic uses the same command marker as the comment.
403 // expected-warning@+1 {{'@param' command used in a comment that is not attached to a function declaration}}
404 /// @param aaa Meow.
405 typedef unsigned int test_not_function_like_typedef3;
407 // expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
408 /// \param aaa Meow.
409 typedef foo::not_a_function_wrapper<1> test_not_function_like_typedef4;
411 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
412 /// \param aaa Meow.
413 /// \param bbb Bbb.
414 /// \returns aaa.
415 using test_function_like_using1 = int (int aaa, int ccc);
417 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
418 /// \param aaa Meow.
419 /// \param bbb Bbb.
420 /// \returns aaa.
421 using test_function_like_using2 = int (*)(int aaa, int ccc);
423 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
424 /// \param aaa Meow.
425 /// \param bbb Bbb.
426 /// \returns aaa.
427 using test_function_like_using3 = int (* const)(int aaa, int ccc);
429 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
430 /// \param aaa Meow.
431 /// \param bbb Bbb.
432 /// \returns aaa.
433 using test_function_like_using4 = int (C::*)(int aaa, int ccc);
435 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
436 /// \param aaa Meow.
437 /// \param bbb Bbb.
438 /// \returns aaa.
439 using test_function_like_using5 = foo::function_wrapper<int (int aaa, int ccc)>;
441 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
442 /// \param aaa Meow.
443 /// \param bbb Bbb.
444 /// \returns aaa.
445 using test_function_like_using6 = foo::function_wrapper<int (int aaa, int ccc)> *;
447 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
448 /// \param aaa Meow.
449 /// \param bbb Bbb.
450 /// \returns aaa.
451 using test_function_like_using7 = foo::function_wrapper<int (int aaa, int ccc)> &;
453 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
454 /// \param aaa Meow.
455 /// \param bbb Bbb.
456 /// \returns aaa.
457 using test_function_like_using8 = foo::function_wrapper<int (int aaa, int ccc)> &&;
459 // expected-warning@+4 {{template parameter 'U' not found in the template declaration}} expected-note@+4 {{did you mean 'T'?}}
460 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
461 /// \param aaa Meow.
462 /// \param bbb Bbb.
463 /// \tparam U Uuu.
464 template<typename T>
465 using test_function_like_using9 = int(T aaa, int ccc);
467 // expected-warning@+4 {{template parameter 'U' not found in the template declaration}} expected-note@+4 {{did you mean 'T'?}}
468 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
469 /// \param aaa Meow.
470 /// \param bbb Bbb.
471 /// \tparam U Uuu.
472 template<typename T>
473 using test_function_like_using10 = int (*)(T aaa, int ccc);
475 // expected-warning@+4 {{template parameter 'U' not found in the template declaration}} expected-note@+4 {{did you mean 'T'?}}
476 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
477 /// \param aaa Meow.
478 /// \param bbb Bbb.
479 /// \tparam U Uuu.
480 template<typename T>
481 using test_function_like_using11 = foo::function_wrapper<int (T aaa, int ccc)>;
483 // expected-warning@+4 {{template parameter 'U' not found in the template declaration}} expected-note@+4 {{did you mean 'T'?}}
484 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
485 /// \param aaa Meow.
486 /// \param bbb Bbb.
487 /// \tparam U Uuu.
488 template<typename T>
489 using test_function_like_using12 = foo::function_wrapper<int (T aaa, int ccc)> *;
491 using test_not_function_like_using1 = int (*)(int aaa);
493 // expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
494 /// \param aaa Meow.
495 using test_not_function_like_using2 = test_not_function_like_using1;
497 // Check that the diagnostic uses the same command marker as the comment.
498 // expected-warning@+1 {{'@param' command used in a comment that is not attached to a function declaration}}
499 /// @param aaa Meow.
500 using test_not_function_like_using3 = unsigned int;
502 // expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
503 /// \param aaa Meow.
504 using test_not_function_like_using4 = foo::not_a_function_wrapper<1>;
506 /// \param aaa Aaa
507 /// \param ... Vararg
508 int test_vararg_param1(int aaa, ...);
510 /// \param ... Vararg
511 int test_vararg_param2(...);
513 // expected-warning@+1 {{parameter '...' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
514 /// \param ... Vararg
515 int test_vararg_param3(int aaa);
517 // expected-warning@+1 {{parameter '...' not found in the function declaration}}
518 /// \param ... Vararg
519 int test_vararg_param4();
522 /// \param aaa Aaa
523 /// \param ... Vararg
524 template<typename T>
525 int test_template_vararg_param1(int aaa, ...);
527 /// \param ... Vararg
528 template<typename T>
529 int test_template_vararg_param2(...);
531 // expected-warning@+1 {{parameter '...' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
532 /// \param ... Vararg
533 template<typename T>
534 int test_template_vararg_param3(int aaa);
536 // expected-warning@+1 {{parameter '...' not found in the function declaration}}
537 /// \param ... Vararg
538 template<typename T>
539 int test_template_vararg_param4();
542 // expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
543 /// \tparam T Aaa
544 int test_tparam1;
546 // expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
547 /// \tparam T Aaa
548 void test_tparam2(int aaa);
550 // expected-warning@+1 {{empty paragraph passed to '\tparam' command}}
551 /// \tparam
552 /// \param aaa Blah blah
553 template<typename T>
554 void test_tparam3(T aaa);
556 // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TT'?}}
557 /// \tparam T Aaa
558 template<typename TT>
559 void test_tparam4(TT aaa);
561 // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TT'?}}
562 /// \tparam T Aaa
563 template<typename TT>
564 class test_tparam5 {
565 // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TTT'?}}
566 /// \tparam T Aaa
567 template<typename TTT>
568 void test_tparam6(TTT aaa);
571 /// \tparam T1 Aaa
572 /// \tparam T2 Bbb
573 template<typename T1, typename T2>
574 void test_tparam7(T1 aaa, T2 bbb);
576 // expected-warning@+1 {{template parameter 'SomTy' not found in the template declaration}} expected-note@+1 {{did you mean 'SomeTy'?}}
577 /// \tparam SomTy Aaa
578 /// \tparam OtherTy Bbb
579 template<typename SomeTy, typename OtherTy>
580 void test_tparam8(SomeTy aaa, OtherTy bbb);
582 // expected-warning@+2 {{template parameter 'T1' is already documented}} expected-note@+1 {{previous documentation}}
583 /// \tparam T1 Aaa
584 /// \tparam T1 Bbb
585 template<typename T1, typename T2>
586 void test_tparam9(T1 aaa, T2 bbb);
588 /// \tparam T Aaa
589 /// \tparam TT Bbb
590 template<template<typename T> class TT>
591 void test_tparam10(TT<int> aaa);
593 /// \tparam T Aaa
594 /// \tparam TT Bbb
595 /// \tparam TTT Ccc
596 template<template<template<typename T> class TT, class C> class TTT>
597 void test_tparam11();
599 /// \tparam I Aaa
600 template<int I>
601 void test_tparam12();
603 template<typename T, typename U>
604 class test_tparam13 { };
606 /// \tparam T Aaa
607 template<typename T>
608 using test_tparam14 = test_tparam13<T, int>;
610 // expected-warning@+1 {{template parameter 'U' not found in the template declaration}} expected-note@+1 {{did you mean 'T'?}}
611 /// \tparam U Aaa
612 template<typename T>
613 using test_tparam15 = test_tparam13<T, int>;
615 // ----
617 /// \tparam T Aaa
618 template<typename T>
619 class test_tparam16 { };
621 typedef test_tparam16<int> test_tparam17;
622 typedef test_tparam16<double> test_tparam18;
624 // ----
626 template<typename T>
627 class test_tparam19;
629 typedef test_tparam19<int> test_tparam20;
630 typedef test_tparam19<double> test_tparam21;
632 /// \tparam T Aaa
633 template<typename T>
634 class test_tparam19 { };
636 // ----
638 // expected-warning@+1 {{'@tparam' command used in a comment that is not attached to a template declaration}}
639 /// @tparam T Aaa
640 int test_tparam22;
642 // ----
645 /// Aaa
646 /// \deprecated Bbb
647 void test_deprecated_1(int a) __attribute__((deprecated));
649 #if __cplusplus >= 201402L
650 /// Aaa
651 /// \deprecated Bbb
652 [[deprecated]] void test_deprecated_no_warning_std14(int a);
653 #endif
655 // We don't want \deprecated to warn about empty paragraph. It is fine to use
656 // \deprecated by itself without explanations.
658 /// Aaa
659 /// \deprecated
660 void test_deprecated_2(int a) __attribute__((deprecated));
662 /// Aaa
663 /// \deprecated
664 void test_deprecated_3(int a) __attribute__((availability(macosx,introduced=10.4)));
666 /// Aaa
667 /// \deprecated
668 void test_deprecated_4(int a) __attribute__((unavailable));
670 // 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}}
671 /// Aaa
672 /// \deprecated
673 void test_deprecated_5(int a);
675 // 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}}
676 /// Aaa
677 /// @deprecated
678 void test_deprecated_6(int a) {
681 // expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
682 /// Aaa
683 /// \deprecated
684 template<typename T>
685 void test_deprecated_7(T aaa);
687 class PR43753 {
688 // expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
689 // expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}}
690 /// \deprecated
691 static void test_deprecated_static();
693 // expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
694 // expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}}
695 /// \deprecated
696 static auto test_deprecated_static_trailing_return() -> int;
698 #if __cplusplus >= 201402L
699 // expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
700 // expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}}
701 /// \deprecated
702 static decltype(auto) test_deprecated_static_decltype_auto() { return 1; }
703 #endif
705 // expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
706 // expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}}
707 /// \deprecated
708 void test_deprecated_const() const;
710 // expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
711 // expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}}
712 /// \deprecated
713 auto test_deprecated_trailing_return() -> int;
715 #if __cplusplus >= 201402L
716 // expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
717 // expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}}
718 /// \deprecated
719 decltype(auto) test_deprecated_decltype_auto() const { return a; }
721 private:
722 int a{0};
723 #endif
726 // expected-note@+2 {{previous command '\headerfile' here}}
727 // expected-warning@+2 {{duplicated command '\headerfile'}}
728 /// \headerfile ""
729 /// \headerfile foo.h
730 int test__headerfile_1(int a);
733 /// \invariant aaa
734 void test_invariant_1(int a);
736 // expected-warning@+1 {{empty paragraph passed to '\invariant' command}}
737 /// \invariant
738 void test_invariant_2(int a);
741 // no-warning
742 /// \returns Aaa
743 int test_returns_right_decl_1(int);
745 class test_returns_right_decl_2 {
746 // no-warning
747 /// \returns Aaa
748 int test_returns_right_decl_3(int);
751 // no-warning
752 /// \returns Aaa
753 template<typename T>
754 int test_returns_right_decl_4(T aaa);
756 // no-warning
757 /// \returns Aaa
758 template<>
759 int test_returns_right_decl_4(int aaa);
761 /// \returns Aaa
762 template<typename T>
763 T test_returns_right_decl_5(T aaa);
765 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
766 /// \returns Aaa
767 int test_returns_wrong_decl_1_backslash;
769 // Check that the diagnostic uses the same command marker as the comment.
770 // expected-warning@+1 {{'@returns' command used in a comment that is not attached to a function or method declaration}}
771 /// @returns Aaa
772 int test_returns_wrong_decl_1_at;
774 // expected-warning@+1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
775 /// \return Aaa
776 int test_returns_wrong_decl_2;
778 // expected-warning@+1 {{'\result' command used in a comment that is not attached to a function or method declaration}}
779 /// \result Aaa
780 int test_returns_wrong_decl_3;
782 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
783 /// \returns Aaa
784 void test_returns_wrong_decl_4(int);
786 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
787 /// \returns Aaa
788 template<typename T>
789 void test_returns_wrong_decl_5(T aaa);
791 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
792 /// \returns Aaa
793 template<>
794 void test_returns_wrong_decl_5(int aaa);
796 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
797 /// \returns Aaa
798 struct test_returns_wrong_decl_6 { };
800 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
801 /// \returns Aaa
802 class test_returns_wrong_decl_7 {
803 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a constructor}}
804 /// \returns Aaa
805 test_returns_wrong_decl_7();
807 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a destructor}}
808 /// \returns Aaa
809 ~test_returns_wrong_decl_7();
812 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
813 /// \returns Aaa
814 enum test_returns_wrong_decl_8 {
815 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
816 /// \returns Aaa
817 test_returns_wrong_decl_9
820 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
821 /// \returns Aaa
822 namespace test_returns_wrong_decl_10 { };
824 // expected-warning@+1 {{'@function' command should be used in a comment attached to a function declaration}}
825 /*! @function test_function
827 typedef unsigned int Base64Flags;
828 unsigned test_function(Base64Flags inFlags);
830 // expected-warning@+1 {{'@callback' command should be used in a comment attached to a pointer to function declaration}}
831 /*! @callback test_callback
833 typedef unsigned int BaseFlags;
834 unsigned (*test_callback)(BaseFlags inFlags);
836 // expected-warning@+1 {{'\endverbatim' command does not terminate a verbatim text block}}
837 /// \endverbatim
838 int test_verbatim_1();
840 // expected-warning@+1 {{'\endcode' command does not terminate a verbatim text block}}
841 /// \endcode
842 int test_verbatim_2();
844 // FIXME: we give a bad diagnostic here because we throw away non-documentation
845 // comments early.
847 // expected-warning@+3 {{'\endcode' command does not terminate a verbatim text block}}
848 /// \code
849 // foo
850 /// \endcode
851 int test_verbatim_3();
854 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
855 int test1; ///< \brief\author Aaa
857 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
858 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
859 int test2, ///< \brief\author Aaa
860 test3; ///< \brief\author Aaa
862 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
863 int test4; ///< \brief
864 ///< \author Aaa
867 class TestRelates {};
869 /// \relates TestRelates
870 /// \brief Aaa
871 void test_relates_1();
873 /// \related TestRelates
874 /// \brief Aaa
875 void test_relates_2();
877 /// \relatesalso TestRelates
878 /// \brief Aaa
879 void test_relates_3();
881 /// \relatedalso TestRelates
882 /// \brief Aaa
883 void test_relates_4();
886 // Check that we attach the comment to the declaration during parsing in the
887 // following cases. The test is based on the fact that we don't parse
888 // documentation comments that are not attached to anything.
890 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
891 /// \brief\author Aaa
892 int test_attach1;
894 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
895 /// \brief\author Aaa
896 int test_attach2(int);
898 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
899 /// \brief\author Aaa
900 struct test_attach3 {
901 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
902 /// \brief\author Aaa
903 int test_attach4;
905 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
906 int test_attach5; ///< \brief\author Aaa
908 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
909 /// \brief\author Aaa
910 int test_attach6(int);
913 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
914 /// \brief\author Aaa
915 class test_attach7 {
916 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
917 /// \brief\author Aaa
918 int test_attach8;
920 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
921 int test_attach9; ///< \brief\author Aaa
923 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
924 /// \brief\author Aaa
925 int test_attach10(int);
928 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
929 /// \brief\author Aaa
930 enum test_attach9 {
931 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
932 /// \brief\author Aaa
933 test_attach10,
935 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
936 test_attach11 ///< \brief\author Aaa
939 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
940 /// \brief\author Aaa
941 struct test_noattach12 *test_attach13;
943 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
944 /// \brief\author Aaa
945 typedef struct test_noattach14 *test_attach15;
947 // expected-warning@+1 + {{empty paragraph passed to '\brief' command}}
948 /// \brief\author Aaa
949 typedef struct test_attach16 { int a; } test_attach17;
951 struct S { int a; };
953 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
954 /// \brief\author Aaa
955 struct S *test_attach18;
957 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
958 /// \brief\author Aaa
959 typedef struct S *test_attach19;
961 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
962 /// \brief\author Aaa
963 struct test_attach20;
965 // expected-warning@+1 + {{empty paragraph passed to '\brief' command}}
966 /// \brief\author Aaa
967 typedef struct test_attach21 {
968 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
969 /// \brief\author Aaa
970 int test_attach22;
971 } test_attach23;
973 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
974 /// \brief\author Aaa
975 namespace test_attach24 {
976 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
977 /// \brief\author Aaa
978 namespace test_attach25 {
982 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
983 /// \brief\author Aaa
984 /// \tparam T Aaa
985 template<typename T>
986 void test_attach26(T aaa);
988 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
989 /// \brief\author Aaa
990 /// \tparam T Aaa
991 template<typename T, typename U>
992 void test_attach27(T aaa, U bbb);
994 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
995 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
996 /// \brief\author Aaa
997 /// \tparam T Aaa
998 template<>
999 void test_attach27(int aaa, int bbb);
1001 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1002 /// \brief\author Aaa
1003 /// \tparam T Aaa
1004 template<typename T>
1005 class test_attach28 {
1006 T aaa;
1009 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1010 /// \brief\author Aaa
1011 using test_attach29 = test_attach28<int>;
1013 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1014 /// \brief\author Aaa
1015 /// \tparam T Aaa
1016 template<typename T, typename U>
1017 class test_attach30 { };
1019 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1020 /// \brief\author Aaa
1021 /// \tparam T Aaa
1022 template<typename T>
1023 class test_attach30<T, int> { };
1025 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1026 /// \brief\author Aaa
1027 template<>
1028 class test_attach30<int, int> { };
1030 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1031 /// \brief\author Aaa
1032 template<typename T>
1033 using test_attach31 = test_attach30<T, int>;
1035 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1036 /// \brief\author Aaa
1037 /// \tparam T Aaa
1038 template<typename T, typename U, typename V>
1039 class test_attach32 { };
1041 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1042 /// \brief\author Aaa
1043 /// \tparam T Aaa
1044 template<typename T, typename U>
1045 class test_attach32<T, U, int> { };
1047 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1048 /// \brief\author Aaa
1049 /// \tparam T Aaa
1050 template<typename T>
1051 class test_attach32<T, int, int> { };
1053 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
1054 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
1055 /// \brief\author Aaa
1056 /// \tparam T Aaa
1057 template<>
1058 class test_attach32<int, int, int> { };
1060 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1061 /// \brief\author Aaa
1062 class test_attach33 {
1063 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1064 /// \brief\author Aaa
1065 /// \tparam T Aaa
1066 template<typename T, typename U>
1067 void test_attach34(T aaa, U bbb);
1070 template<typename T>
1071 class test_attach35 {
1072 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
1073 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
1074 /// \brief\author Aaa
1075 /// \tparam T Aaa
1076 template<typename TT, typename UU>
1077 void test_attach36(TT aaa, UU bbb);
1080 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
1081 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
1082 /// \brief\author Aaa
1083 /// \tparam T Aaa
1084 template<> template<>
1085 void test_attach35<int>::test_attach36(int aaa, int bbb) {}
1087 template<typename T>
1088 class test_attach37 {
1089 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
1090 // expected-warning@+2 {{'\tparam' command used in a comment that is not attached to a template declaration}}
1091 /// \brief\author Aaa
1092 /// \tparam T Aaa
1093 void test_attach38(int aaa, int bbb);
1095 void test_attach39(int aaa, int bbb);
1098 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
1099 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
1100 /// \brief\author Aaa
1101 /// \tparam T Aaa
1102 template<>
1103 void test_attach37<int>::test_attach38(int aaa, int bbb) {}
1105 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1106 /// \brief\author Aaa
1107 /// \tparam T Aaa
1108 template<typename T>
1109 void test_attach37<T>::test_attach39(int aaa, int bbb) {}
1111 // We used to emit warning that parameter 'a' is not found because we parsed
1112 // the comment in context of the redeclaration which does not have parameter
1113 // names.
1114 template <typename T>
1115 struct test_attach38 {
1117 \param a First param
1118 \param b Second param
1120 template <typename B>
1121 void test_attach39(T a, B b);
1124 template <>
1125 template <typename B>
1126 void test_attach38<int>::test_attach39(int, B);
1128 // The inline comments expect a string after the command.
1129 // expected-warning@+1 {{'\a' command has no word arguments, expected 1}}
1130 /// \a
1131 int test_inline_no_argument_a_bad(int);
1133 /// \a A
1134 int test_inline_no_argument_a_good(int);
1136 // expected-warning@+1 {{'\anchor' command has no word arguments, expected 1}}
1137 /// \anchor
1138 int test_inline_no_argument_anchor_bad(int);
1140 /// \anchor A
1141 int test_inline_no_argument_anchor_good(int);
1143 // expected-warning@+1 {{'@b' command has no word arguments, expected 1}}
1144 /// @b
1145 int test_inline_no_argument_b_bad(int);
1147 /// @b A
1148 int test_inline_no_argument_b_good(int);
1150 // expected-warning@+1 {{'\c' command has no word arguments, expected 1}}
1151 /// \c
1152 int test_inline_no_argument_c_bad(int);
1154 /// \c A
1155 int test_inline_no_argument_c_good(int);
1157 // expected-warning@+1 {{'\e' command has no word arguments, expected 1}}
1158 /// \e
1159 int test_inline_no_argument_e_bad(int);
1161 /// \e A
1162 int test_inline_no_argument_e_good(int);
1164 // expected-warning@+1 {{'\em' command has no word arguments, expected 1}}
1165 /// \em
1166 int test_inline_no_argument_em_bad(int);
1168 /// \em A
1169 int test_inline_no_argument_em_good(int);
1171 // expected-warning@+1 {{'\p' command has no word arguments, expected 1}}
1172 /// \p
1173 int test_inline_no_argument_p_bad(int);
1175 /// \p A
1176 int test_inline_no_argument_p_good(int);
1178 // PR13411, reduced. We used to crash on this.
1180 * @code Aaa.
1182 void test_nocrash1(int);
1184 // We used to crash on this.
1185 // expected-warning@+2 {{empty paragraph passed to '\param' command}}
1186 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1187 /// \param\brief
1188 void test_nocrash2(int);
1190 // PR13593, example 1 and 2
1193 * Bla.
1195 template <typename>
1196 void test_nocrash3();
1198 /// Foo
1199 template <typename, typename>
1200 void test_nocrash4() { }
1202 template <typename>
1203 void test_nocrash3()
1207 // PR13593, example 3
1210 * aaa
1212 template <typename T>
1213 inline T test_nocrash5(T a1)
1215 return a1;
1221 inline void test_nocrash6()
1223 test_nocrash5(1);
1226 // We used to crash on this.
1229 Blah.
1231 typedef const struct test_nocrash7 * test_nocrash8;
1233 // We used to crash on this.
1235 // expected-warning@+1 {{unknown command tag name}}
1236 /// aaa \unknown aaa \unknown aaa
1237 int test_nocrash9;
1239 // We used to crash on this. PR15068
1241 // expected-warning@+2 {{empty paragraph passed to '@param' command}}
1242 // expected-warning@+2 {{empty paragraph passed to '@param' command}}
1243 ///@param x
1244 ///@param y
1245 int test_nocrash10(int x, int y);
1247 // expected-warning@+2 {{empty paragraph passed to '@param' command}} expected-warning@+2 {{parameter 'x' not found in the function declaration}}
1248 // expected-warning@+2 {{empty paragraph passed to '@param' command}} expected-warning@+2 {{parameter 'y' not found in the function declaration}}
1249 ///@param x
1250 ///@param y
1251 int test_nocrash11();
1253 // expected-warning@+3 {{empty paragraph passed to '@param' command}} expected-warning@+3 {{parameter 'x' not found in the function declaration}}
1254 // expected-warning@+3 {{empty paragraph passed to '@param' command}} expected-warning@+3 {{parameter 'y' not found in the function declaration}}
1256 @param x
1257 @param y
1259 int test_nocrash12();
1261 // expected-warning@+2 {{empty paragraph passed to '@param' command}}
1262 // expected-warning@+1 {{empty paragraph passed to '@param' command}}
1263 ///@param x@param y
1264 int test_nocrash13(int x, int y);
1267 * \verbatim
1268 * Aaa
1270 int test_nocrash14();
1272 // expected-warning@+2 {{'@union' command should not be used in a comment attached to a non-union declaration}}
1274 @union U This is new
1276 struct U { int iS; };
1279 @union U1
1281 union U1 {int i; };
1283 // expected-warning@+2 {{'@struct' command should not be used in a comment attached to a non-struct declaration}}
1285 @struct S2
1287 union S2 {};
1290 @class C1
1292 class C1;
1295 @struct S3;
1297 class S3;
1299 //----------------------------------------------------------------------
1300 /// @class Predicate Predicate.h "lldb/Host/Predicate.h"
1301 /// @brief A C++ wrapper class for providing threaded access to a value
1302 /// of type T.
1304 /// A templatized class.
1305 /// specified values.
1306 //----------------------------------------------------------------------
1307 template <class T, class T1>
1308 class Predicate
1312 //----------------------------------------------------------------------
1313 /// @class Predicate<int, char> Predicate.h "lldb/Host/Predicate.h"
1314 /// @brief A C++ wrapper class for providing threaded access to a value
1315 /// of type T.
1317 /// A template specialization class.
1318 //----------------------------------------------------------------------
1319 template<> class Predicate<int, char>
1323 //----------------------------------------------------------------------
1324 /// @class Predicate<T, int> Predicate.h "lldb/Host/Predicate.h"
1325 /// @brief A C++ wrapper class for providing threaded access to a value
1326 /// of type T.
1328 /// A partial specialization template class.
1329 //----------------------------------------------------------------------
1330 template<class T> class Predicate<T, int>
1334 /*! @function test_function
1336 template <class T> T test_function (T arg);
1338 /*! @function test_function<int>
1340 template <> int test_function<int> (int arg);
1342 namespace AllowParamAndReturnsOnFunctionPointerVars {
1345 * functionPointerVariable
1347 * @param i is integer.
1348 * @returns integer.
1350 int (*functionPointerVariable)(int i);
1352 #if __cplusplus >= 201402L
1354 * functionPointerVariableTemplate
1356 * @param i is something.
1357 * @returns integer.
1359 template<typename T>
1360 int (*functionPointerVariableTemplate)(T i);
1361 #endif
1363 struct HasFields {
1365 * functionPointerField
1367 * @param i is integer.
1368 * @returns integer.
1370 int (*functionPointerField)(int i);
1372 #if __cplusplus >= 201402L
1374 * functionPointerTemplateMember
1376 * @tparam T some type.
1377 * @param i is integer.
1378 * @returns integer.
1380 template<typename T>
1381 static int (*functionPointerTemplateMember)(int i);
1382 #endif
1385 // expected-warning@+5 {{parameter 'p' not found in the function declaration}}
1386 // expected-warning@+5 {{'\returns' command used in a comment that is attached to a function returning void}}
1388 * functionPointerVariable
1390 * \param p not here.
1391 * \returns integer.
1393 void (*functionPointerVariableThatLeadsNowhere)();
1395 #if __cplusplus >= 201402L
1396 // expected-warning@+8 {{template parameter 'X' not found in the template declaration}}
1397 // expected-note@+7 {{did you mean 'T'?}}
1398 // expected-warning@+7 {{parameter 'p' not found in the function declaration}}
1399 // expected-note@+6 {{did you mean 'x'?}}
1400 // expected-warning@+6 {{'\returns' command used in a comment that is attached to a function returning void}}
1402 * functionPointerVariable
1404 * \tparam X typo
1405 * \param p not here.
1406 * \returns integer.
1408 template<typename T>
1409 void (*functionPointerVariableTemplateThatLeadsNowhere)(T x);
1410 #endif
1412 // Still warn about param/returns commands for variables that don't specify
1413 // the type directly:
1416 * FunctionPointerTypedef
1418 * \param i is integer.
1419 * \returns integer.
1421 typedef int (*FunctionPointerTypedef)(int i);
1424 * FunctionPointerTypealias
1426 * \param i is integer.
1427 * \returns integer.
1429 using FunctionPointerTypealias = int (*)(int i);
1431 // expected-warning@+5 {{'@param' command used in a comment that is not attached to a function declaration}}
1432 // expected-warning@+5 {{'@returns' command used in a comment that is not attached to a function or method declaration}}
1434 * functionPointerVariable
1436 * @param i is integer.
1437 * @returns integer.
1439 FunctionPointerTypedef functionPointerTypedefVariable;
1441 struct HasMoreFields {
1442 // expected-warning@+5 {{'\param' command used in a comment that is not attached to a function declaration}}
1443 // expected-warning@+5 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
1445 * functionPointerTypealiasField
1447 * \param i is integer.
1448 * \returns integer.
1450 FunctionPointerTypealias functionPointerTypealiasField;
1456 * Function pointer typedef with variadic params.
1458 * @param a
1459 * works
1461 * @param ...
1462 * now should work too.
1464 typedef void (*VariadicFnType)(int a, ...);
1467 * Function pointer type alias with variadic params.
1469 * @param a
1470 * works
1472 * @param ...
1473 * now should work too.
1475 using VariadicFnType2 = void (*)(int a, ...);
1478 * Function pointer type variable.
1480 * @param a
1481 * works
1483 * @param ...
1484 * now should work too.
1486 void (*variadicFnVar)(int a, ...);
1488 // expected-warning@+2 {{empty paragraph passed to '@note' command}}
1490 @note
1491 \f$\texttt{mu}_{00}=\texttt{m}_{00}\f$, \f$\texttt{nu}_{00}=1\f$
1492 \f$\texttt{nu}_{10}=\texttt{mu}_{10}=\texttt{mu}_{01}=\texttt{mu}_{10}=0\f$
1494 class EmptyNoteNoCrash {
1497 namespace PR42844 { // Assertion failures when using typedefed function pointers
1498 typedef void (*AA)();
1499 typedef AA A();
1500 A *a; ///< \return none
1501 // expected-warning@-1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
1503 typedef void B();
1504 B *b; ///< \return none
1505 // expected-warning@-1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
1507 void CC();
1508 typedef void C();
1509 C &c = CC; ///< \return none
1510 // expected-warning@-1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
1512 using DD = void(*)();
1513 using D = DD();
1514 D *d; ///< \return none
1515 // expected-warning@-1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
1517 using E = void();
1518 E *e; ///< \return none
1519 // expected-warning@-1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
1521 void FF();
1522 using F = void();
1523 F &f = FF; ///< \return none
1524 // expected-warning@-1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
1526 } // namespace PR42844