[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Sema / warn-documentation.cpp
blob284ae97b0f88fb66ac94b6d279b9073fd8581635
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 // rdar://13066276
220 // Check that the diagnostic uses the same command marker as the comment.
221 // expected-warning@+1 {{'@param' command used in a comment that is not attached to a function declaration}}
222 /// @param a Blah blah.
223 int test_param1_at;
225 // expected-warning@+1 {{empty paragraph passed to '\param' command}}
226 /// \param
227 /// \param a Blah blah.
228 int test_param2(int a);
230 // expected-warning@+1 {{empty paragraph passed to '\param' command}}
231 /// \param a
232 int test_param3(int a);
234 /// \param a Blah blah.
235 int test_param4(int a);
237 /// \param [in] a Blah blah.
238 int test_param5(int a);
240 /// \param [out] a Blah blah.
241 int test_param6(int a);
243 /// \param [in,out] a Blah blah.
244 int test_param7(int a);
246 // expected-warning@+1 {{whitespace is not allowed in parameter passing direction}}
247 /// \param [ in ] a Blah blah.
248 int test_param8(int a);
250 // expected-warning@+1 {{whitespace is not allowed in parameter passing direction}}
251 /// \param [in, out] a Blah blah.
252 int test_param9(int a);
254 // expected-warning@+1 {{unrecognized parameter passing direction, valid directions are '[in]', '[out]' and '[in,out]'}}
255 /// \param [ junk] a Blah blah.
256 int test_param10(int a);
258 // expected-warning@+1 {{parameter 'a' not found in the function declaration}}
259 /// \param a Blah blah.
260 int test_param11();
262 // expected-warning@+1 {{parameter 'A' not found in the function declaration}} expected-note@+1 {{did you mean 'a'?}}
263 /// \param A Blah blah.
264 int test_param12(int a);
266 // expected-warning@+1 {{parameter 'aab' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
267 /// \param aab Blah blah.
268 int test_param13(int aaa, int bbb);
270 // expected-warning@+2 {{parameter 'aab' not found in the function declaration}} expected-note@+2 {{did you mean 'bbb'?}}
271 /// \param aaa Blah blah.
272 /// \param aab Blah blah.
273 int test_param14(int aaa, int bbb);
275 // expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
276 /// \param aab Blah blah.
277 int test_param15(int bbb, int ccc);
279 // expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
280 /// \param aab Ccc.
281 /// \param aaa Aaa.
282 /// \param bbb Bbb.
283 int test_param16(int aaa, int bbb);
285 // expected-warning@+2 {{parameter 'aab' not found in the function declaration}}
286 /// \param aaa Aaa.
287 /// \param aab Ccc.
288 /// \param bbb Bbb.
289 int test_param17(int aaa, int bbb);
291 // expected-warning@+3 {{parameter 'aab' not found in the function declaration}}
292 /// \param aaa Aaa.
293 /// \param bbb Bbb.
294 /// \param aab Ccc.
295 int test_param18(int aaa, int bbb);
297 class C {
298 // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}}
299 /// \param aaa Blah blah.
300 C(int bbb, int ccc);
302 // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}}
303 /// \param aaa Blah blah.
304 int test_param19(int bbb, int ccc);
307 // expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
308 /// \param aab Blah blah.
309 template<typename T>
310 void test_param20(int bbb, int ccc);
312 // expected-warning@+3 {{parameter 'a' is already documented}}
313 // expected-note@+1 {{previous documentation}}
314 /// \param a Aaa.
315 /// \param a Aaa.
316 int test_param21(int a);
318 // expected-warning@+4 {{parameter 'x2' is already documented}}
319 // expected-note@+2 {{previous documentation}}
320 /// \param x1 Aaa.
321 /// \param x2 Bbb.
322 /// \param x2 Ccc.
323 int test_param22(int x1, int x2, int x3);
325 // expected-warning@+1 {{empty paragraph passed to '\param' command}}
326 /// \param a
327 /// \retval 0 Blah blah.
328 int test_param23(int a);
330 /// \param a \ref test_param23 has an empty paragraph, this doesn't.
331 int test_param24(int a);
333 //===---
334 // Test that we treat typedefs to some non-function types as functions for the
335 // purposes of documentation comment parsing.
336 //===---
338 namespace foo {
339 inline namespace bar {
340 template<typename>
341 struct function_wrapper {};
343 template<unsigned>
344 struct not_a_function_wrapper {};
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 int test_function_like_typedef1(int aaa, int ccc);
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 int (*test_function_like_typedef2)(int aaa, int ccc);
360 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
361 /// \param aaa Meow.
362 /// \param bbb Bbb.
363 /// \returns aaa.
364 typedef int (* const test_function_like_typedef3)(int aaa, int ccc);
366 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
367 /// \param aaa Meow.
368 /// \param bbb Bbb.
369 /// \returns aaa.
370 typedef int (C::*test_function_like_typedef4)(int aaa, int ccc);
372 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
373 /// \param aaa Meow.
374 /// \param bbb Bbb.
375 /// \returns aaa.
376 typedef foo::function_wrapper<int (int aaa, int ccc)> test_function_like_typedef5;
378 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
379 /// \param aaa Meow.
380 /// \param bbb Bbb.
381 /// \returns aaa.
382 typedef foo::function_wrapper<int (int aaa, int ccc)> *test_function_like_typedef6;
384 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
385 /// \param aaa Meow.
386 /// \param bbb Bbb.
387 /// \returns aaa.
388 typedef foo::function_wrapper<int (int aaa, int ccc)> &test_function_like_typedef7;
390 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
391 /// \param aaa Meow.
392 /// \param bbb Bbb.
393 /// \returns aaa.
394 typedef foo::function_wrapper<int (int aaa, int ccc)> &&test_function_like_typedef8;
397 typedef int (*test_not_function_like_typedef1)(int aaa);
399 // expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
400 /// \param aaa Meow.
401 typedef test_not_function_like_typedef1 test_not_function_like_typedef2;
403 // rdar://13066276
404 // Check that the diagnostic uses the same command marker as the comment.
405 // expected-warning@+1 {{'@param' command used in a comment that is not attached to a function declaration}}
406 /// @param aaa Meow.
407 typedef unsigned int test_not_function_like_typedef3;
409 // expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
410 /// \param aaa Meow.
411 typedef foo::not_a_function_wrapper<1> test_not_function_like_typedef4;
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_using1 = int (int aaa, int ccc);
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_using2 = int (*)(int aaa, int ccc);
425 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
426 /// \param aaa Meow.
427 /// \param bbb Bbb.
428 /// \returns aaa.
429 using test_function_like_using3 = int (* const)(int aaa, int ccc);
431 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
432 /// \param aaa Meow.
433 /// \param bbb Bbb.
434 /// \returns aaa.
435 using test_function_like_using4 = int (C::*)(int aaa, int ccc);
437 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
438 /// \param aaa Meow.
439 /// \param bbb Bbb.
440 /// \returns aaa.
441 using test_function_like_using5 = foo::function_wrapper<int (int aaa, int ccc)>;
443 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
444 /// \param aaa Meow.
445 /// \param bbb Bbb.
446 /// \returns aaa.
447 using test_function_like_using6 = foo::function_wrapper<int (int aaa, int ccc)> *;
449 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
450 /// \param aaa Meow.
451 /// \param bbb Bbb.
452 /// \returns aaa.
453 using test_function_like_using7 = foo::function_wrapper<int (int aaa, int ccc)> &;
455 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
456 /// \param aaa Meow.
457 /// \param bbb Bbb.
458 /// \returns aaa.
459 using test_function_like_using8 = foo::function_wrapper<int (int aaa, int ccc)> &&;
461 // expected-warning@+4 {{template parameter 'U' not found in the template declaration}} expected-note@+4 {{did you mean 'T'?}}
462 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
463 /// \param aaa Meow.
464 /// \param bbb Bbb.
465 /// \tparam U Uuu.
466 template<typename T>
467 using test_function_like_using9 = int(T aaa, int ccc);
469 // expected-warning@+4 {{template parameter 'U' not found in the template declaration}} expected-note@+4 {{did you mean 'T'?}}
470 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
471 /// \param aaa Meow.
472 /// \param bbb Bbb.
473 /// \tparam U Uuu.
474 template<typename T>
475 using test_function_like_using10 = int (*)(T aaa, int ccc);
477 // expected-warning@+4 {{template parameter 'U' not found in the template declaration}} expected-note@+4 {{did you mean 'T'?}}
478 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
479 /// \param aaa Meow.
480 /// \param bbb Bbb.
481 /// \tparam U Uuu.
482 template<typename T>
483 using test_function_like_using11 = foo::function_wrapper<int (T aaa, int ccc)>;
485 // expected-warning@+4 {{template parameter 'U' not found in the template declaration}} expected-note@+4 {{did you mean 'T'?}}
486 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
487 /// \param aaa Meow.
488 /// \param bbb Bbb.
489 /// \tparam U Uuu.
490 template<typename T>
491 using test_function_like_using12 = foo::function_wrapper<int (T aaa, int ccc)> *;
493 using test_not_function_like_using1 = int (*)(int aaa);
495 // expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
496 /// \param aaa Meow.
497 using test_not_function_like_using2 = test_not_function_like_using1;
499 // Check that the diagnostic uses the same command marker as the comment.
500 // expected-warning@+1 {{'@param' command used in a comment that is not attached to a function declaration}}
501 /// @param aaa Meow.
502 using test_not_function_like_using3 = unsigned int;
504 // expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
505 /// \param aaa Meow.
506 using test_not_function_like_using4 = foo::not_a_function_wrapper<1>;
508 /// \param aaa Aaa
509 /// \param ... Vararg
510 int test_vararg_param1(int aaa, ...);
512 /// \param ... Vararg
513 int test_vararg_param2(...);
515 // expected-warning@+1 {{parameter '...' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
516 /// \param ... Vararg
517 int test_vararg_param3(int aaa);
519 // expected-warning@+1 {{parameter '...' not found in the function declaration}}
520 /// \param ... Vararg
521 int test_vararg_param4();
524 /// \param aaa Aaa
525 /// \param ... Vararg
526 template<typename T>
527 int test_template_vararg_param1(int aaa, ...);
529 /// \param ... Vararg
530 template<typename T>
531 int test_template_vararg_param2(...);
533 // expected-warning@+1 {{parameter '...' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
534 /// \param ... Vararg
535 template<typename T>
536 int test_template_vararg_param3(int aaa);
538 // expected-warning@+1 {{parameter '...' not found in the function declaration}}
539 /// \param ... Vararg
540 template<typename T>
541 int test_template_vararg_param4();
544 // expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
545 /// \tparam T Aaa
546 int test_tparam1;
548 // expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
549 /// \tparam T Aaa
550 void test_tparam2(int aaa);
552 // expected-warning@+1 {{empty paragraph passed to '\tparam' command}}
553 /// \tparam
554 /// \param aaa Blah blah
555 template<typename T>
556 void test_tparam3(T aaa);
558 // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TT'?}}
559 /// \tparam T Aaa
560 template<typename TT>
561 void test_tparam4(TT aaa);
563 // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TT'?}}
564 /// \tparam T Aaa
565 template<typename TT>
566 class test_tparam5 {
567 // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TTT'?}}
568 /// \tparam T Aaa
569 template<typename TTT>
570 void test_tparam6(TTT aaa);
573 /// \tparam T1 Aaa
574 /// \tparam T2 Bbb
575 template<typename T1, typename T2>
576 void test_tparam7(T1 aaa, T2 bbb);
578 // expected-warning@+1 {{template parameter 'SomTy' not found in the template declaration}} expected-note@+1 {{did you mean 'SomeTy'?}}
579 /// \tparam SomTy Aaa
580 /// \tparam OtherTy Bbb
581 template<typename SomeTy, typename OtherTy>
582 void test_tparam8(SomeTy aaa, OtherTy bbb);
584 // expected-warning@+2 {{template parameter 'T1' is already documented}} expected-note@+1 {{previous documentation}}
585 /// \tparam T1 Aaa
586 /// \tparam T1 Bbb
587 template<typename T1, typename T2>
588 void test_tparam9(T1 aaa, T2 bbb);
590 /// \tparam T Aaa
591 /// \tparam TT Bbb
592 template<template<typename T> class TT>
593 void test_tparam10(TT<int> aaa);
595 /// \tparam T Aaa
596 /// \tparam TT Bbb
597 /// \tparam TTT Ccc
598 template<template<template<typename T> class TT, class C> class TTT>
599 void test_tparam11();
601 /// \tparam I Aaa
602 template<int I>
603 void test_tparam12();
605 template<typename T, typename U>
606 class test_tparam13 { };
608 /// \tparam T Aaa
609 template<typename T>
610 using test_tparam14 = test_tparam13<T, int>;
612 // expected-warning@+1 {{template parameter 'U' not found in the template declaration}} expected-note@+1 {{did you mean 'T'?}}
613 /// \tparam U Aaa
614 template<typename T>
615 using test_tparam15 = test_tparam13<T, int>;
617 // ----
619 /// \tparam T Aaa
620 template<typename T>
621 class test_tparam16 { };
623 typedef test_tparam16<int> test_tparam17;
624 typedef test_tparam16<double> test_tparam18;
626 // ----
628 template<typename T>
629 class test_tparam19;
631 typedef test_tparam19<int> test_tparam20;
632 typedef test_tparam19<double> test_tparam21;
634 /// \tparam T Aaa
635 template<typename T>
636 class test_tparam19 { };
638 // ----
640 // expected-warning@+1 {{'@tparam' command used in a comment that is not attached to a template declaration}}
641 /// @tparam T Aaa
642 int test_tparam22;
644 // ----
647 /// Aaa
648 /// \deprecated Bbb
649 void test_deprecated_1(int a) __attribute__((deprecated));
651 #if __cplusplus >= 201402L
652 /// Aaa
653 /// \deprecated Bbb
654 [[deprecated]] void test_deprecated_no_warning_std14(int a);
655 #endif
657 // We don't want \deprecated to warn about empty paragraph. It is fine to use
658 // \deprecated by itself without explanations.
660 /// Aaa
661 /// \deprecated
662 void test_deprecated_2(int a) __attribute__((deprecated));
664 /// Aaa
665 /// \deprecated
666 void test_deprecated_3(int a) __attribute__((availability(macosx,introduced=10.4)));
668 /// Aaa
669 /// \deprecated
670 void test_deprecated_4(int a) __attribute__((unavailable));
672 // 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}}
673 /// Aaa
674 /// \deprecated
675 void test_deprecated_5(int a);
677 // 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}}
678 /// Aaa
679 /// @deprecated
680 void test_deprecated_6(int a) {
683 // expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
684 /// Aaa
685 /// \deprecated
686 template<typename T>
687 void test_deprecated_7(T aaa);
689 class PR43753 {
690 // expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
691 // expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}}
692 /// \deprecated
693 static void test_deprecated_static();
695 // expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
696 // expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}}
697 /// \deprecated
698 static auto test_deprecated_static_trailing_return() -> int;
700 #if __cplusplus >= 201402L
701 // expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
702 // expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}}
703 /// \deprecated
704 static decltype(auto) test_deprecated_static_decltype_auto() { return 1; }
705 #endif
707 // expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
708 // expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}}
709 /// \deprecated
710 void test_deprecated_const() const;
712 // expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
713 // expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}}
714 /// \deprecated
715 auto test_deprecated_trailing_return() -> int;
717 #if __cplusplus >= 201402L
718 // expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
719 // expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}}
720 /// \deprecated
721 decltype(auto) test_deprecated_decltype_auto() const { return a; }
723 private:
724 int a{0};
725 #endif
728 // rdar://12397511
729 // expected-note@+2 {{previous command '\headerfile' here}}
730 // expected-warning@+2 {{duplicated command '\headerfile'}}
731 /// \headerfile ""
732 /// \headerfile foo.h
733 int test__headerfile_1(int a);
736 /// \invariant aaa
737 void test_invariant_1(int a);
739 // expected-warning@+1 {{empty paragraph passed to '\invariant' command}}
740 /// \invariant
741 void test_invariant_2(int a);
744 // no-warning
745 /// \returns Aaa
746 int test_returns_right_decl_1(int);
748 class test_returns_right_decl_2 {
749 // no-warning
750 /// \returns Aaa
751 int test_returns_right_decl_3(int);
754 // no-warning
755 /// \returns Aaa
756 template<typename T>
757 int test_returns_right_decl_4(T aaa);
759 // no-warning
760 /// \returns Aaa
761 template<>
762 int test_returns_right_decl_4(int aaa);
764 /// \returns Aaa
765 template<typename T>
766 T test_returns_right_decl_5(T aaa);
768 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
769 /// \returns Aaa
770 int test_returns_wrong_decl_1_backslash;
772 // rdar://13066276
773 // Check that the diagnostic uses the same command marker as the comment.
774 // expected-warning@+1 {{'@returns' command used in a comment that is not attached to a function or method declaration}}
775 /// @returns Aaa
776 int test_returns_wrong_decl_1_at;
778 // expected-warning@+1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
779 /// \return Aaa
780 int test_returns_wrong_decl_2;
782 // expected-warning@+1 {{'\result' command used in a comment that is not attached to a function or method declaration}}
783 /// \result Aaa
784 int test_returns_wrong_decl_3;
786 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
787 /// \returns Aaa
788 void test_returns_wrong_decl_4(int);
790 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
791 /// \returns Aaa
792 template<typename T>
793 void test_returns_wrong_decl_5(T aaa);
795 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
796 /// \returns Aaa
797 template<>
798 void test_returns_wrong_decl_5(int aaa);
800 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
801 /// \returns Aaa
802 struct test_returns_wrong_decl_6 { };
804 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
805 /// \returns Aaa
806 class test_returns_wrong_decl_7 {
807 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a constructor}}
808 /// \returns Aaa
809 test_returns_wrong_decl_7();
811 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a destructor}}
812 /// \returns Aaa
813 ~test_returns_wrong_decl_7();
816 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
817 /// \returns Aaa
818 enum test_returns_wrong_decl_8 {
819 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
820 /// \returns Aaa
821 test_returns_wrong_decl_9
824 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
825 /// \returns Aaa
826 namespace test_returns_wrong_decl_10 { };
828 // rdar://13094352
829 // expected-warning@+1 {{'@function' command should be used in a comment attached to a function declaration}}
830 /*! @function test_function
832 typedef unsigned int Base64Flags;
833 unsigned test_function(Base64Flags inFlags);
835 // expected-warning@+1 {{'@callback' command should be used in a comment attached to a pointer to function declaration}}
836 /*! @callback test_callback
838 typedef unsigned int BaseFlags;
839 unsigned (*test_callback)(BaseFlags inFlags);
841 // expected-warning@+1 {{'\endverbatim' command does not terminate a verbatim text block}}
842 /// \endverbatim
843 int test_verbatim_1();
845 // expected-warning@+1 {{'\endcode' command does not terminate a verbatim text block}}
846 /// \endcode
847 int test_verbatim_2();
849 // FIXME: we give a bad diagnostic here because we throw away non-documentation
850 // comments early.
852 // expected-warning@+3 {{'\endcode' command does not terminate a verbatim text block}}
853 /// \code
854 // foo
855 /// \endcode
856 int test_verbatim_3();
859 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
860 int test1; ///< \brief\author Aaa
862 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
863 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
864 int test2, ///< \brief\author Aaa
865 test3; ///< \brief\author Aaa
867 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
868 int test4; ///< \brief
869 ///< \author Aaa
872 class TestRelates {};
874 /// \relates TestRelates
875 /// \brief Aaa
876 void test_relates_1();
878 /// \related TestRelates
879 /// \brief Aaa
880 void test_relates_2();
882 /// \relatesalso TestRelates
883 /// \brief Aaa
884 void test_relates_3();
886 /// \relatedalso TestRelates
887 /// \brief Aaa
888 void test_relates_4();
891 // Check that we attach the comment to the declaration during parsing in the
892 // following cases. The test is based on the fact that we don't parse
893 // documentation comments that are not attached to anything.
895 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
896 /// \brief\author Aaa
897 int test_attach1;
899 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
900 /// \brief\author Aaa
901 int test_attach2(int);
903 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
904 /// \brief\author Aaa
905 struct test_attach3 {
906 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
907 /// \brief\author Aaa
908 int test_attach4;
910 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
911 int test_attach5; ///< \brief\author Aaa
913 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
914 /// \brief\author Aaa
915 int test_attach6(int);
918 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
919 /// \brief\author Aaa
920 class test_attach7 {
921 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
922 /// \brief\author Aaa
923 int test_attach8;
925 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
926 int test_attach9; ///< \brief\author Aaa
928 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
929 /// \brief\author Aaa
930 int test_attach10(int);
933 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
934 /// \brief\author Aaa
935 enum test_attach9 {
936 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
937 /// \brief\author Aaa
938 test_attach10,
940 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
941 test_attach11 ///< \brief\author Aaa
944 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
945 /// \brief\author Aaa
946 struct test_noattach12 *test_attach13;
948 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
949 /// \brief\author Aaa
950 typedef struct test_noattach14 *test_attach15;
952 // expected-warning@+1 + {{empty paragraph passed to '\brief' command}}
953 /// \brief\author Aaa
954 typedef struct test_attach16 { int a; } test_attach17;
956 struct S { int a; };
958 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
959 /// \brief\author Aaa
960 struct S *test_attach18;
962 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
963 /// \brief\author Aaa
964 typedef struct S *test_attach19;
966 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
967 /// \brief\author Aaa
968 struct test_attach20;
970 // expected-warning@+1 + {{empty paragraph passed to '\brief' command}}
971 /// \brief\author Aaa
972 typedef struct test_attach21 {
973 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
974 /// \brief\author Aaa
975 int test_attach22;
976 } test_attach23;
978 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
979 /// \brief\author Aaa
980 namespace test_attach24 {
981 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
982 /// \brief\author Aaa
983 namespace test_attach25 {
987 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
988 /// \brief\author Aaa
989 /// \tparam T Aaa
990 template<typename T>
991 void test_attach26(T aaa);
993 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
994 /// \brief\author Aaa
995 /// \tparam T Aaa
996 template<typename T, typename U>
997 void test_attach27(T aaa, U bbb);
999 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
1000 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
1001 /// \brief\author Aaa
1002 /// \tparam T Aaa
1003 template<>
1004 void test_attach27(int aaa, int bbb);
1006 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1007 /// \brief\author Aaa
1008 /// \tparam T Aaa
1009 template<typename T>
1010 class test_attach28 {
1011 T aaa;
1014 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1015 /// \brief\author Aaa
1016 using test_attach29 = test_attach28<int>;
1018 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1019 /// \brief\author Aaa
1020 /// \tparam T Aaa
1021 template<typename T, typename U>
1022 class test_attach30 { };
1024 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1025 /// \brief\author Aaa
1026 /// \tparam T Aaa
1027 template<typename T>
1028 class test_attach30<T, int> { };
1030 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1031 /// \brief\author Aaa
1032 template<>
1033 class test_attach30<int, int> { };
1035 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1036 /// \brief\author Aaa
1037 template<typename T>
1038 using test_attach31 = test_attach30<T, int>;
1040 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1041 /// \brief\author Aaa
1042 /// \tparam T Aaa
1043 template<typename T, typename U, typename V>
1044 class test_attach32 { };
1046 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1047 /// \brief\author Aaa
1048 /// \tparam T Aaa
1049 template<typename T, typename U>
1050 class test_attach32<T, U, int> { };
1052 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1053 /// \brief\author Aaa
1054 /// \tparam T Aaa
1055 template<typename T>
1056 class test_attach32<T, int, int> { };
1058 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
1059 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
1060 /// \brief\author Aaa
1061 /// \tparam T Aaa
1062 template<>
1063 class test_attach32<int, int, int> { };
1065 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1066 /// \brief\author Aaa
1067 class test_attach33 {
1068 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1069 /// \brief\author Aaa
1070 /// \tparam T Aaa
1071 template<typename T, typename U>
1072 void test_attach34(T aaa, U bbb);
1075 template<typename T>
1076 class test_attach35 {
1077 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
1078 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
1079 /// \brief\author Aaa
1080 /// \tparam T Aaa
1081 template<typename TT, typename UU>
1082 void test_attach36(TT aaa, UU bbb);
1085 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
1086 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
1087 /// \brief\author Aaa
1088 /// \tparam T Aaa
1089 template<> template<>
1090 void test_attach35<int>::test_attach36(int aaa, int bbb) {}
1092 template<typename T>
1093 class test_attach37 {
1094 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
1095 // expected-warning@+2 {{'\tparam' command used in a comment that is not attached to a template declaration}}
1096 /// \brief\author Aaa
1097 /// \tparam T Aaa
1098 void test_attach38(int aaa, int bbb);
1100 void test_attach39(int aaa, int bbb);
1103 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
1104 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
1105 /// \brief\author Aaa
1106 /// \tparam T Aaa
1107 template<>
1108 void test_attach37<int>::test_attach38(int aaa, int bbb) {}
1110 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1111 /// \brief\author Aaa
1112 /// \tparam T Aaa
1113 template<typename T>
1114 void test_attach37<T>::test_attach39(int aaa, int bbb) {}
1116 // We used to emit warning that parameter 'a' is not found because we parsed
1117 // the comment in context of the redeclaration which does not have parameter
1118 // names.
1119 template <typename T>
1120 struct test_attach38 {
1122 \param a First param
1123 \param b Second param
1125 template <typename B>
1126 void test_attach39(T a, B b);
1129 template <>
1130 template <typename B>
1131 void test_attach38<int>::test_attach39(int, B);
1133 // The inline comments expect a string after the command.
1134 // expected-warning@+1 {{'\a' command has no word arguments, expected 1}}
1135 /// \a
1136 int test_inline_no_argument_a_bad(int);
1138 /// \a A
1139 int test_inline_no_argument_a_good(int);
1141 // expected-warning@+1 {{'\anchor' command has no word arguments, expected 1}}
1142 /// \anchor
1143 int test_inline_no_argument_anchor_bad(int);
1145 /// \anchor A
1146 int test_inline_no_argument_anchor_good(int);
1148 // expected-warning@+1 {{'@b' command has no word arguments, expected 1}}
1149 /// @b
1150 int test_inline_no_argument_b_bad(int);
1152 /// @b A
1153 int test_inline_no_argument_b_good(int);
1155 // expected-warning@+1 {{'\c' command has no word arguments, expected 1}}
1156 /// \c
1157 int test_inline_no_argument_c_bad(int);
1159 /// \c A
1160 int test_inline_no_argument_c_good(int);
1162 // expected-warning@+1 {{'\e' command has no word arguments, expected 1}}
1163 /// \e
1164 int test_inline_no_argument_e_bad(int);
1166 /// \e A
1167 int test_inline_no_argument_e_good(int);
1169 // expected-warning@+1 {{'\em' command has no word arguments, expected 1}}
1170 /// \em
1171 int test_inline_no_argument_em_bad(int);
1173 /// \em A
1174 int test_inline_no_argument_em_good(int);
1176 // expected-warning@+1 {{'\p' command has no word arguments, expected 1}}
1177 /// \p
1178 int test_inline_no_argument_p_bad(int);
1180 /// \p A
1181 int test_inline_no_argument_p_good(int);
1183 // PR13411, reduced. We used to crash on this.
1185 * @code Aaa.
1187 void test_nocrash1(int);
1189 // We used to crash on this.
1190 // expected-warning@+2 {{empty paragraph passed to '\param' command}}
1191 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
1192 /// \param\brief
1193 void test_nocrash2(int);
1195 // PR13593, example 1 and 2
1198 * Bla.
1200 template <typename>
1201 void test_nocrash3();
1203 /// Foo
1204 template <typename, typename>
1205 void test_nocrash4() { }
1207 template <typename>
1208 void test_nocrash3()
1212 // PR13593, example 3
1215 * aaa
1217 template <typename T>
1218 inline T test_nocrash5(T a1)
1220 return a1;
1226 inline void test_nocrash6()
1228 test_nocrash5(1);
1231 // We used to crash on this.
1234 Blah.
1236 typedef const struct test_nocrash7 * test_nocrash8;
1238 // We used to crash on this.
1240 // expected-warning@+1 {{unknown command tag name}}
1241 /// aaa \unknown aaa \unknown aaa
1242 int test_nocrash9;
1244 // We used to crash on this. PR15068
1246 // expected-warning@+2 {{empty paragraph passed to '@param' command}}
1247 // expected-warning@+2 {{empty paragraph passed to '@param' command}}
1248 ///@param x
1249 ///@param y
1250 int test_nocrash10(int x, int y);
1252 // expected-warning@+2 {{empty paragraph passed to '@param' command}} expected-warning@+2 {{parameter 'x' not found in the function declaration}}
1253 // expected-warning@+2 {{empty paragraph passed to '@param' command}} expected-warning@+2 {{parameter 'y' not found in the function declaration}}
1254 ///@param x
1255 ///@param y
1256 int test_nocrash11();
1258 // expected-warning@+3 {{empty paragraph passed to '@param' command}} expected-warning@+3 {{parameter 'x' not found in the function declaration}}
1259 // expected-warning@+3 {{empty paragraph passed to '@param' command}} expected-warning@+3 {{parameter 'y' not found in the function declaration}}
1261 @param x
1262 @param y
1264 int test_nocrash12();
1266 // expected-warning@+2 {{empty paragraph passed to '@param' command}}
1267 // expected-warning@+1 {{empty paragraph passed to '@param' command}}
1268 ///@param x@param y
1269 int test_nocrash13(int x, int y);
1272 * \verbatim
1273 * Aaa
1275 int test_nocrash14();
1277 // rdar://12379114
1278 // expected-warning@+2 {{'@union' command should not be used in a comment attached to a non-union declaration}}
1280 @union U This is new
1282 struct U { int iS; };
1285 @union U1
1287 union U1 {int i; };
1289 // expected-warning@+2 {{'@struct' command should not be used in a comment attached to a non-struct declaration}}
1291 @struct S2
1293 union S2 {};
1296 @class C1
1298 class C1;
1301 @struct S3;
1303 class S3;
1305 // rdar://14124702
1306 //----------------------------------------------------------------------
1307 /// @class Predicate Predicate.h "lldb/Host/Predicate.h"
1308 /// @brief A C++ wrapper class for providing threaded access to a value
1309 /// of type T.
1311 /// A templatized class.
1312 /// specified values.
1313 //----------------------------------------------------------------------
1314 template <class T, class T1>
1315 class Predicate
1319 //----------------------------------------------------------------------
1320 /// @class Predicate<int, char> Predicate.h "lldb/Host/Predicate.h"
1321 /// @brief A C++ wrapper class for providing threaded access to a value
1322 /// of type T.
1324 /// A template specialization class.
1325 //----------------------------------------------------------------------
1326 template<> class Predicate<int, char>
1330 //----------------------------------------------------------------------
1331 /// @class Predicate<T, int> Predicate.h "lldb/Host/Predicate.h"
1332 /// @brief A C++ wrapper class for providing threaded access to a value
1333 /// of type T.
1335 /// A partial specialization template class.
1336 //----------------------------------------------------------------------
1337 template<class T> class Predicate<T, int>
1341 /*! @function test_function
1343 template <class T> T test_function (T arg);
1345 /*! @function test_function<int>
1347 template <> int test_function<int> (int arg);
1349 namespace AllowParamAndReturnsOnFunctionPointerVars {
1352 * functionPointerVariable
1354 * @param i is integer.
1355 * @returns integer.
1357 int (*functionPointerVariable)(int i);
1359 #if __cplusplus >= 201402L
1361 * functionPointerVariableTemplate
1363 * @param i is something.
1364 * @returns integer.
1366 template<typename T>
1367 int (*functionPointerVariableTemplate)(T i);
1368 #endif
1370 struct HasFields {
1372 * functionPointerField
1374 * @param i is integer.
1375 * @returns integer.
1377 int (*functionPointerField)(int i);
1379 #if __cplusplus >= 201402L
1381 * functionPointerTemplateMember
1383 * @tparam T some type.
1384 * @param i is integer.
1385 * @returns integer.
1387 template<typename T>
1388 static int (*functionPointerTemplateMember)(int i);
1389 #endif
1392 // expected-warning@+5 {{parameter 'p' not found in the function declaration}}
1393 // expected-warning@+5 {{'\returns' command used in a comment that is attached to a function returning void}}
1395 * functionPointerVariable
1397 * \param p not here.
1398 * \returns integer.
1400 void (*functionPointerVariableThatLeadsNowhere)();
1402 #if __cplusplus >= 201402L
1403 // expected-warning@+8 {{template parameter 'X' not found in the template declaration}}
1404 // expected-note@+7 {{did you mean 'T'?}}
1405 // expected-warning@+7 {{parameter 'p' not found in the function declaration}}
1406 // expected-note@+6 {{did you mean 'x'?}}
1407 // expected-warning@+6 {{'\returns' command used in a comment that is attached to a function returning void}}
1409 * functionPointerVariable
1411 * \tparam X typo
1412 * \param p not here.
1413 * \returns integer.
1415 template<typename T>
1416 void (*functionPointerVariableTemplateThatLeadsNowhere)(T x);
1417 #endif
1419 // Still warn about param/returns commands for variables that don't specify
1420 // the type directly:
1423 * FunctionPointerTypedef
1425 * \param i is integer.
1426 * \returns integer.
1428 typedef int (*FunctionPointerTypedef)(int i);
1431 * FunctionPointerTypealias
1433 * \param i is integer.
1434 * \returns integer.
1436 using FunctionPointerTypealias = int (*)(int i);
1438 // expected-warning@+5 {{'@param' command used in a comment that is not attached to a function declaration}}
1439 // expected-warning@+5 {{'@returns' command used in a comment that is not attached to a function or method declaration}}
1441 * functionPointerVariable
1443 * @param i is integer.
1444 * @returns integer.
1446 FunctionPointerTypedef functionPointerTypedefVariable;
1448 struct HasMoreFields {
1449 // expected-warning@+5 {{'\param' command used in a comment that is not attached to a function declaration}}
1450 // expected-warning@+5 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
1452 * functionPointerTypealiasField
1454 * \param i is integer.
1455 * \returns integer.
1457 FunctionPointerTypealias functionPointerTypealiasField;
1463 * Function pointer typedef with variadic params.
1465 * @param a
1466 * works
1468 * @param ...
1469 * now should work too.
1471 typedef void (*VariadicFnType)(int a, ...);
1474 * Function pointer type alias with variadic params.
1476 * @param a
1477 * works
1479 * @param ...
1480 * now should work too.
1482 using VariadicFnType2 = void (*)(int a, ...);
1485 * Function pointer type variable.
1487 * @param a
1488 * works
1490 * @param ...
1491 * now should work too.
1493 void (*variadicFnVar)(int a, ...);
1495 // expected-warning@+2 {{empty paragraph passed to '@note' command}}
1497 @note
1498 \f$\texttt{mu}_{00}=\texttt{m}_{00}\f$, \f$\texttt{nu}_{00}=1\f$
1499 \f$\texttt{nu}_{10}=\texttt{mu}_{10}=\texttt{mu}_{01}=\texttt{mu}_{10}=0\f$
1501 class EmptyNoteNoCrash {
1504 namespace PR42844 { // Assertion failures when using typedefed function pointers
1505 typedef void (*AA)();
1506 typedef AA A();
1507 A *a; ///< \return none
1508 // expected-warning@-1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
1510 typedef void B();
1511 B *b; ///< \return none
1512 // expected-warning@-1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
1514 void CC();
1515 typedef void C();
1516 C &c = CC; ///< \return none
1517 // expected-warning@-1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
1519 using DD = void(*)();
1520 using D = DD();
1521 D *d; ///< \return none
1522 // expected-warning@-1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
1524 using E = void();
1525 E *e; ///< \return none
1526 // expected-warning@-1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
1528 void FF();
1529 using F = void();
1530 F &f = FF; ///< \return none
1531 // expected-warning@-1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
1533 } // namespace PR42844