1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wdocumentation -Wdocumentation-pedantic -verify %s
2 
3 // This file contains lots of corner cases, so ensure that XML we generate is not invalid.
4 // RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s | FileCheck %s -check-prefix=WRONG
5 // WRONG-NOT: CommentXMLInvalid
6 
7 // expected-warning@+1 {{expected quoted string after equals sign}}
8 /// <a href=>
9 int test_html1(int);
10 
11 // expected-warning@+1 {{expected quoted string after equals sign}}
12 /// <a href==>
13 int test_html2(int);
14 
15 // expected-warning@+2 {{expected quoted string after equals sign}}
16 // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
17 /// <a href= blah
18 int test_html3(int);
19 
20 // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
21 /// <a =>
22 int test_html4(int);
23 
24 // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
25 /// <a "aaa">
26 int test_html5(int);
27 
28 // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
29 /// <a a="b" =>
30 int test_html6(int);
31 
32 // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
33 /// <a a="b" "aaa">
34 int test_html7(int);
35 
36 // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
37 /// <a a="b" =
38 int test_html8(int);
39 
40 // expected-warning@+2 {{HTML start tag prematurely ended, expected attribute name or '>'}} expected-note@+1 {{HTML tag started here}}
41 /** Aaa bbb<img ddd eee
42  * fff ggg.
43  */
44 int test_html9(int);
45 
46 // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
47 /** Aaa bbb<img ddd eee 42%
48  * fff ggg.
49  */
50 int test_html10(int);
51 
52 // expected-warning@+1 {{HTML end tag 'br' is forbidden}}
53 /// <br></br>
54 int test_html11(int);
55 
56 /// <blockquote>Meow</blockquote>
57 int test_html_nesting1(int);
58 
59 /// <b><i>Meow</i></b>
60 int test_html_nesting2(int);
61 
62 /// <p>Aaa<br>
63 /// Bbb</p>
64 int test_html_nesting3(int);
65 
66 /// <p>Aaa<br />
67 /// Bbb</p>
68 int test_html_nesting4(int);
69 
70 // expected-warning@+1 {{HTML end tag does not match any start tag}}
71 /// <b><i>Meow</a>
72 int test_html_nesting5(int);
73 
74 // expected-warning@+2 {{HTML start tag 'i' closed by 'b'}}
75 // expected-warning@+1 {{HTML end tag does not match any start tag}}
76 /// <b><i>Meow</b></b>
77 int test_html_nesting6(int);
78 
79 // expected-warning@+2 {{HTML start tag 'i' closed by 'b'}}
80 // expected-warning@+1 {{HTML end tag does not match any start tag}}
81 /// <b><i>Meow</b></i>
82 int test_html_nesting7(int);
83 
84 
85 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
86 /// \brief\returns Aaa
87 int test_block_command1(int);
88 
89 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
90 /// \brief \returns Aaa
91 int test_block_command2(int);
92 
93 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
94 /// \brief
95 /// \returns Aaa
96 int test_block_command3(int);
97 
98 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
99 /// \brief
100 ///
101 /// \returns Aaa
102 int test_block_command4(int);
103 
104 // There is trailing whitespace on one of the following lines, don't remove it!
105 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
106 /// \brief
107 ///
108 /// \returns Aaa
109 int test_block_command5(int);
110 
111 /// \brief \c Aaa
112 int test_block_command6(int);
113 
114 // expected-warning@+5 {{duplicated command '\brief'}} expected-note@+1 {{previous command '\brief' here}}
115 /// \brief Aaa
116 ///
117 /// Bbb
118 ///
119 /// \brief Ccc
120 int test_duplicate_brief1(int);
121 
122 // expected-warning@+5 {{duplicated command '\short'}} expected-note@+1 {{previous command '\short' here}}
123 /// \short Aaa
124 ///
125 /// Bbb
126 ///
127 /// \short Ccc
128 int test_duplicate_brief2(int);
129 
130 // expected-warning@+5 {{duplicated command '\brief'}} expected-note@+1 {{previous command '\short' (an alias of '\brief') here}}
131 /// \short Aaa
132 ///
133 /// Bbb
134 ///
135 /// \brief Ccc
136 int test_duplicate_brief3(int);
137 
138 
139 /// \return Aaa
140 ///
141 /// Bbb
142 ///
143 /// \return Ccc
144 int test_multiple_returns1(int);
145 
146 /// \returns Aaa
147 ///
148 /// Bbb
149 ///
150 /// \returns Ccc
151 int test_multiple_returns2(int);
152 
153 /// \result Aaa
154 ///
155 /// Bbb
156 ///
157 /// \result Ccc
158 int test_multiple_returns3(int);
159 
160 /// \returns Aaa
161 ///
162 /// Bbb
163 ///
164 /// \return Ccc
165 int test_multiple_returns4(int);
166 
167 
168 // expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
169 /// \param a Blah blah.
170 int test_param1;
171 
172 // expected-warning@+1 {{empty paragraph passed to '\param' command}}
173 /// \param
174 /// \param a Blah blah.
175 int test_param2(int a);
176 
177 // expected-warning@+1 {{empty paragraph passed to '\param' command}}
178 /// \param a
179 int test_param3(int a);
180 
181 /// \param a Blah blah.
182 int test_param4(int a);
183 
184 /// \param [in] a Blah blah.
185 int test_param5(int a);
186 
187 /// \param [out] a Blah blah.
188 int test_param6(int a);
189 
190 /// \param [in,out] a Blah blah.
191 int test_param7(int a);
192 
193 // expected-warning@+1 {{whitespace is not allowed in parameter passing direction}}
194 /// \param [ in ] a Blah blah.
195 int test_param8(int a);
196 
197 // expected-warning@+1 {{whitespace is not allowed in parameter passing direction}}
198 /// \param [in, out] a Blah blah.
199 int test_param9(int a);
200 
201 // expected-warning@+1 {{unrecognized parameter passing direction, valid directions are '[in]', '[out]' and '[in,out]'}}
202 /// \param [ junk] a Blah blah.
203 int test_param10(int a);
204 
205 // expected-warning@+1 {{parameter 'a' not found in the function declaration}}
206 /// \param a Blah blah.
207 int test_param11();
208 
209 // expected-warning@+1 {{parameter 'A' not found in the function declaration}} expected-note@+1 {{did you mean 'a'?}}
210 /// \param A Blah blah.
211 int test_param12(int a);
212 
213 // expected-warning@+1 {{parameter 'aab' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
214 /// \param aab Blah blah.
215 int test_param13(int aaa, int bbb);
216 
217 // expected-warning@+2 {{parameter 'aab' not found in the function declaration}} expected-note@+2 {{did you mean 'bbb'?}}
218 /// \param aaa Blah blah.
219 /// \param aab Blah blah.
220 int test_param14(int aaa, int bbb);
221 
222 // expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
223 /// \param aab Blah blah.
224 int test_param15(int bbb, int ccc);
225 
226 // expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
227 /// \param aab Ccc.
228 /// \param aaa Aaa.
229 /// \param bbb Bbb.
230 int test_param16(int aaa, int bbb);
231 
232 // expected-warning@+2 {{parameter 'aab' not found in the function declaration}}
233 /// \param aaa Aaa.
234 /// \param aab Ccc.
235 /// \param bbb Bbb.
236 int test_param17(int aaa, int bbb);
237 
238 // expected-warning@+3 {{parameter 'aab' not found in the function declaration}}
239 /// \param aaa Aaa.
240 /// \param bbb Bbb.
241 /// \param aab Ccc.
242 int test_param18(int aaa, int bbb);
243 
244 class C {
245   // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}}
246   /// \param aaa Blah blah.
247   C(int bbb, int ccc);
248 
249   // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}}
250   /// \param aaa Blah blah.
251  int test_param19(int bbb, int ccc);
252 };
253 
254 // expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
255 /// \param aab Blah blah.
256 template<typename T>
257 void test_param20(int bbb, int ccc);
258 
259 // expected-warning@+3 {{parameter 'a' is already documented}}
260 // expected-note@+1 {{previous documentation}}
261 /// \param a Aaa.
262 /// \param a Aaa.
263 int test_param21(int a);
264 
265 // expected-warning@+4 {{parameter 'x2' is already documented}}
266 // expected-note@+2 {{previous documentation}}
267 /// \param x1 Aaa.
268 /// \param x2 Bbb.
269 /// \param x2 Ccc.
270 int test_param22(int x1, int x2, int x3);
271 
272 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
273 /// \param aaa Meow.
274 /// \param bbb Bbb.
275 /// \returns aaa.
276 typedef int test_param23(int aaa, int ccc);
277 
278 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
279 /// \param aaa Meow.
280 /// \param bbb Bbb.
281 /// \returns aaa.
282 typedef int (*test_param24)(int aaa, int ccc);
283 
284 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
285 /// \param aaa Meow.
286 /// \param bbb Bbb.
287 /// \returns aaa.
288 typedef int (* const test_param25)(int aaa, int ccc);
289 
290 // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
291 /// \param aaa Meow.
292 /// \param bbb Bbb.
293 /// \returns aaa.
294 typedef int (C::*test_param26)(int aaa, int ccc);
295 
296 typedef int (*test_param27)(int aaa);
297 
298 // expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
299 /// \param aaa Meow.
300 typedef test_param27 test_param28;
301 
302 // rdar://13066276
303 // expected-warning@+1 {{'@param' command used in a comment that is not attached to a function declaration}}
304 /// @param aaa Meow.
305 typedef unsigned int test_param29;
306 
307 
308 /// \param aaa Aaa
309 /// \param ... Vararg
310 int test_vararg_param1(int aaa, ...);
311 
312 /// \param ... Vararg
313 int test_vararg_param2(...);
314 
315 // expected-warning@+1 {{parameter '...' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
316 /// \param ... Vararg
317 int test_vararg_param3(int aaa);
318 
319 // expected-warning@+1 {{parameter '...' not found in the function declaration}}
320 /// \param ... Vararg
321 int test_vararg_param4();
322 
323 
324 // expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
325 /// \tparam T Aaa
326 int test_tparam1;
327 
328 // expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
329 /// \tparam T Aaa
330 void test_tparam2(int aaa);
331 
332 // expected-warning@+1 {{empty paragraph passed to '\tparam' command}}
333 /// \tparam
334 /// \param aaa Blah blah
335 template<typename T>
336 void test_tparam3(T aaa);
337 
338 // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TT'?}}
339 /// \tparam T Aaa
340 template<typename TT>
341 void test_tparam4(TT aaa);
342 
343 // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TT'?}}
344 /// \tparam T Aaa
345 template<typename TT>
346 class test_tparam5 {
347   // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TTT'?}}
348   /// \tparam T Aaa
349   template<typename TTT>
350   void test_tparam6(TTT aaa);
351 };
352 
353 /// \tparam T1 Aaa
354 /// \tparam T2 Bbb
355 template<typename T1, typename T2>
356 void test_tparam7(T1 aaa, T2 bbb);
357 
358 // expected-warning@+1 {{template parameter 'SomTy' not found in the template declaration}} expected-note@+1 {{did you mean 'SomeTy'?}}
359 /// \tparam SomTy Aaa
360 /// \tparam OtherTy Bbb
361 template<typename SomeTy, typename OtherTy>
362 void test_tparam8(SomeTy aaa, OtherTy bbb);
363 
364 // expected-warning@+2 {{template parameter 'T1' is already documented}} expected-note@+1 {{previous documentation}}
365 /// \tparam T1 Aaa
366 /// \tparam T1 Bbb
367 template<typename T1, typename T2>
368 void test_tparam9(T1 aaa, T2 bbb);
369 
370 /// \tparam T Aaa
371 /// \tparam TT Bbb
372 template<template<typename T> class TT>
373 void test_tparam10(TT<int> aaa);
374 
375 /// \tparam T Aaa
376 /// \tparam TT Bbb
377 /// \tparam TTT Ccc
378 template<template<template<typename T> class TT, class C> class TTT>
379 void test_tparam11();
380 
381 /// \tparam I Aaa
382 template<int I>
383 void test_tparam12();
384 
385 template<typename T, typename U>
386 class test_tparam13 { };
387 
388 /// \tparam T Aaa
389 template<typename T>
390 using test_tparam14 = test_tparam13<T, int>;
391 
392 // expected-warning@+1 {{template parameter 'U' not found in the template declaration}} expected-note@+1 {{did you mean 'T'?}}
393 /// \tparam U Aaa
394 template<typename T>
395 using test_tparam15 = test_tparam13<T, int>;
396 
397 // ----
398 
399 /// \tparam T Aaa
400 template<typename T>
401 class test_tparam16 { };
402 
403 typedef test_tparam16<int> test_tparam17;
404 typedef test_tparam16<double> test_tparam18;
405 
406 // ----
407 
408 template<typename T>
409 class test_tparam19;
410 
411 typedef test_tparam19<int> test_tparam20;
412 typedef test_tparam19<double> test_tparam21;
413 
414 /// \tparam T Aaa
415 template<typename T>
416 class test_tparam19 { };
417 
418 // ----
419 
420 // expected-warning@+1 {{'@tparam' command used in a comment that is not attached to a template declaration}}
421 /// @tparam T Aaa
422 int test_tparam22;
423 
424 // ----
425 
426 
427 /// Aaa
428 /// \deprecated Bbb
429 void test_deprecated_1(int a) __attribute__((deprecated));
430 
431 // We don't want \deprecated to warn about empty paragraph.  It is fine to use
432 // \deprecated by itself without explanations.
433 
434 /// Aaa
435 /// \deprecated
436 void test_deprecated_2(int a) __attribute__((deprecated));
437 
438 /// Aaa
439 /// \deprecated
440 void test_deprecated_3(int a) __attribute__((availability(macosx,introduced=10.4)));
441 
442 /// Aaa
443 /// \deprecated
444 void test_deprecated_4(int a) __attribute__((unavailable));
445 
446 // 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}}
447 /// Aaa
448 /// \deprecated
449 void test_deprecated_5(int a);
450 
451 // 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}}
452 /// Aaa
453 /// \deprecated
454 void test_deprecated_6(int a) {
455 }
456 
457 // expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
458 /// Aaa
459 /// \deprecated
460 template<typename T>
461 void test_deprecated_7(T aaa);
462 
463 
464 // rdar://12397511
465 // expected-note@+2 {{previous command '\headerfile' here}}
466 // expected-warning@+2 {{duplicated command '\headerfile'}}
467 /// \headerfile ""
468 /// \headerfile foo.h
469 int test__headerfile_1(int a);
470 
471 
472 /// \invariant aaa
473 void test_invariant_1(int a);
474 
475 // expected-warning@+1 {{empty paragraph passed to '\invariant' command}}
476 /// \invariant
477 void test_invariant_2(int a);
478 
479 
480 // no-warning
481 /// \returns Aaa
482 int test_returns_right_decl_1(int);
483 
484 class test_returns_right_decl_2 {
485   // no-warning
486   /// \returns Aaa
487   int test_returns_right_decl_3(int);
488 };
489 
490 // no-warning
491 /// \returns Aaa
492 template<typename T>
493 int test_returns_right_decl_4(T aaa);
494 
495 // no-warning
496 /// \returns Aaa
497 template<>
498 int test_returns_right_decl_4(int aaa);
499 
500 /// \returns Aaa
501 template<typename T>
502 T test_returns_right_decl_5(T aaa);
503 
504 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
505 /// \returns Aaa
506 int test_returns_wrong_decl_1;
507 
508 // expected-warning@+1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
509 /// \return Aaa
510 int test_returns_wrong_decl_2;
511 
512 // expected-warning@+1 {{'\result' command used in a comment that is not attached to a function or method declaration}}
513 /// \result Aaa
514 int test_returns_wrong_decl_3;
515 
516 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
517 /// \returns Aaa
518 void test_returns_wrong_decl_4(int);
519 
520 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
521 /// \returns Aaa
522 template<typename T>
523 void test_returns_wrong_decl_5(T aaa);
524 
525 // expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
526 /// \returns Aaa
527 template<>
528 void test_returns_wrong_decl_5(int aaa);
529 
530 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
531 /// \returns Aaa
532 struct test_returns_wrong_decl_6 { };
533 
534 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
535 /// \returns Aaa
536 class test_returns_wrong_decl_7 {
537   // expected-warning@+1 {{'\returns' command used in a comment that is attached to a constructor}}
538   /// \returns Aaa
539   test_returns_wrong_decl_7();
540 
541   // expected-warning@+1 {{'\returns' command used in a comment that is attached to a destructor}}
542   /// \returns Aaa
543   ~test_returns_wrong_decl_7();
544 };
545 
546 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
547 /// \returns Aaa
548 enum test_returns_wrong_decl_8 {
549   // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
550   /// \returns Aaa
551   test_returns_wrong_decl_9
552 };
553 
554 // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
555 /// \returns Aaa
556 namespace test_returns_wrong_decl_10 { };
557 
558 // rdar://13066276
559 // expected-warning@+1 {{'@returns' command used in a comment that is not attached to a function or method declaration}}
560 /// @returns Aaa
561 typedef unsigned int test_returns_wrong_decl_11;
562 
563 // rdar://13094352
564 // expected-warning@+1 {{'@function' command should be used in a comment attached to a function declaration}}
565 /*!	@function test_function
566 */
567 typedef unsigned int Base64Flags;
568 unsigned test_function(Base64Flags inFlags);
569 
570 // expected-warning@+1 {{'@callback' command should be used in a comment attached to a pointer to function declaration}}
571 /*! @callback test_callback
572 */
573 typedef unsigned int BaseFlags;
574 unsigned (*test_callback)(BaseFlags inFlags);
575 
576 // expected-warning@+1 {{'\endverbatim' command does not terminate a verbatim text block}}
577 /// \endverbatim
578 int test_verbatim_1();
579 
580 // expected-warning@+1 {{'\endcode' command does not terminate a verbatim text block}}
581 /// \endcode
582 int test_verbatim_2();
583 
584 // FIXME: we give a bad diagnostic here because we throw away non-documentation
585 // comments early.
586 //
587 // expected-warning@+3 {{'\endcode' command does not terminate a verbatim text block}}
588 /// \code
589 //  foo
590 /// \endcode
591 int test_verbatim_3();
592 
593 
594 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
595 int test1; ///< \brief\author Aaa
596 
597 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
598 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
599 int test2, ///< \brief\author Aaa
600     test3; ///< \brief\author Aaa
601 
602 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
603 int test4; ///< \brief
604            ///< \author Aaa
605 
606 
607 class TestRelates {};
608 
609 /// \relates TestRelates
610 /// \brief Aaa
611 void test_relates_1();
612 
613 /// \related TestRelates
614 /// \brief Aaa
615 void test_relates_2();
616 
617 /// \relatesalso TestRelates
618 /// \brief Aaa
619 void test_relates_3();
620 
621 /// \relatedalso TestRelates
622 /// \brief Aaa
623 void test_relates_4();
624 
625 
626 // Check that we attach the comment to the declaration during parsing in the
627 // following cases.  The test is based on the fact that we don't parse
628 // documentation comments that are not attached to anything.
629 
630 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
631 /// \brief\author Aaa
632 int test_attach1;
633 
634 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
635 /// \brief\author Aaa
636 int test_attach2(int);
637 
638 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
639 /// \brief\author Aaa
640 struct test_attach3 {
641   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
642   /// \brief\author Aaa
643   int test_attach4;
644 
645   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
646   int test_attach5; ///< \brief\author Aaa
647 
648   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
649   /// \brief\author Aaa
650   int test_attach6(int);
651 };
652 
653 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
654 /// \brief\author Aaa
655 class test_attach7 {
656   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
657   /// \brief\author Aaa
658   int test_attach8;
659 
660   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
661   int test_attach9; ///< \brief\author Aaa
662 
663   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
664   /// \brief\author Aaa
665   int test_attach10(int);
666 };
667 
668 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
669 /// \brief\author Aaa
670 enum test_attach9 {
671   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
672   /// \brief\author Aaa
673   test_attach10,
674 
675   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
676   test_attach11 ///< \brief\author Aaa
677 };
678 
679 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
680 /// \brief\author Aaa
681 struct test_noattach12 *test_attach13;
682 
683 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
684 /// \brief\author Aaa
685 typedef struct test_noattach14 *test_attach15;
686 
687 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
688 /// \brief\author Aaa
689 typedef struct test_attach16 { int a; } test_attach17;
690 
691 struct S { int a; };
692 
693 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
694 /// \brief\author Aaa
695 struct S *test_attach18;
696 
697 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
698 /// \brief\author Aaa
699 typedef struct S *test_attach19;
700 
701 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
702 /// \brief\author Aaa
703 struct test_attach20;
704 
705 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
706 /// \brief\author Aaa
707 typedef struct test_attach21 {
708   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
709   /// \brief\author Aaa
710   int test_attach22;
711 } test_attach23;
712 
713 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
714 /// \brief\author Aaa
715 namespace test_attach24 {
716   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
717   /// \brief\author Aaa
718   namespace test_attach25 {
719   }
720 }
721 
722 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
723 /// \brief\author Aaa
724 /// \tparam T Aaa
725 template<typename T>
726 void test_attach26(T aaa);
727 
728 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
729 /// \brief\author Aaa
730 /// \tparam T Aaa
731 template<typename T, typename U>
732 void test_attach27(T aaa, U bbb);
733 
734 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
735 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
736 /// \brief\author Aaa
737 /// \tparam T Aaa
738 template<>
739 void test_attach27(int aaa, int bbb);
740 
741 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
742 /// \brief\author Aaa
743 /// \tparam T Aaa
744 template<typename T>
745 class test_attach28 {
746   T aaa;
747 };
748 
749 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
750 /// \brief\author Aaa
751 using test_attach29 = test_attach28<int>;
752 
753 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
754 /// \brief\author Aaa
755 /// \tparam T Aaa
756 template<typename T, typename U>
757 class test_attach30 { };
758 
759 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
760 /// \brief\author Aaa
761 /// \tparam T Aaa
762 template<typename T>
763 class test_attach30<T, int> { };
764 
765 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
766 /// \brief\author Aaa
767 template<>
768 class test_attach30<int, int> { };
769 
770 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
771 /// \brief\author Aaa
772 template<typename T>
773 using test_attach31 = test_attach30<T, int>;
774 
775 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
776 /// \brief\author Aaa
777 /// \tparam T Aaa
778 template<typename T, typename U, typename V>
779 class test_attach32 { };
780 
781 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
782 /// \brief\author Aaa
783 /// \tparam T Aaa
784 template<typename T, typename U>
785 class test_attach32<T, U, int> { };
786 
787 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
788 /// \brief\author Aaa
789 /// \tparam T Aaa
790 template<typename T>
791 class test_attach32<T, int, int> { };
792 
793 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
794 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
795 /// \brief\author Aaa
796 /// \tparam T Aaa
797 template<>
798 class test_attach32<int, int, int> { };
799 
800 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
801 /// \brief\author Aaa
802 class test_attach33 {
803   // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
804   /// \brief\author Aaa
805   /// \tparam T Aaa
806   template<typename T, typename U>
807   void test_attach34(T aaa, U bbb);
808 };
809 
810 template<typename T>
811 class test_attach35 {
812   // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
813   // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
814   /// \brief\author Aaa
815   /// \tparam T Aaa
816   template<typename TT, typename UU>
817   void test_attach36(TT aaa, UU bbb);
818 };
819 
820 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
821 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
822 /// \brief\author Aaa
823 /// \tparam T Aaa
824 template<> template<>
825 void test_attach35<int>::test_attach36(int aaa, int bbb) {}
826 
827 template<typename T>
828 class test_attach37 {
829   // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
830   // expected-warning@+2 {{'\tparam' command used in a comment that is not attached to a template declaration}}
831   /// \brief\author Aaa
832   /// \tparam T Aaa
833   void test_attach38(int aaa, int bbb);
834 
835   void test_attach39(int aaa, int bbb);
836 };
837 
838 // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
839 // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
840 /// \brief\author Aaa
841 /// \tparam T Aaa
842 template<>
843 void test_attach37<int>::test_attach38(int aaa, int bbb) {}
844 
845 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
846 /// \brief\author Aaa
847 /// \tparam T Aaa
848 template<typename T>
849 void test_attach37<T>::test_attach39(int aaa, int bbb) {}
850 
851 // We used to emit warning that parameter 'a' is not found because we parsed
852 // the comment in context of the redeclaration which does not have parameter
853 // names.
854 template <typename T>
855 struct test_attach38 {
856   /*!
857     \param a  First param
858     \param b  Second param
859   */
860   template <typename B>
861   void test_attach39(T a, B b);
862 };
863 
864 template <>
865 template <typename B>
866 void test_attach38<int>::test_attach39(int, B);
867 
868 
869 // PR13411, reduced.  We used to crash on this.
870 /**
871  * @code Aaa.
872  */
873 void test_nocrash1(int);
874 
875 // We used to crash on this.
876 // expected-warning@+2 {{empty paragraph passed to '\param' command}}
877 // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
878 /// \param\brief
879 void test_nocrash2(int);
880 
881 // PR13593, example 1 and 2
882 
883 /**
884 * Bla.
885 */
886 template <typename>
887 void test_nocrash3();
888 
889 /// Foo
890 template <typename, typename>
891 void test_nocrash4() { }
892 
893 template <typename>
894 void test_nocrash3()
895 {
896 }
897 
898 // PR13593, example 3
899 
900 /**
901  * aaa
902  */
903 template <typename T>
904 inline T test_nocrash5(T a1)
905 {
906     return a1;
907 }
908 
909 ///
910 //,
911 
912 inline void test_nocrash6()
913 {
914     test_nocrash5(1);
915 }
916 
917 // We used to crash on this.
918 
919 /*!
920   Blah.
921 */
922 typedef const struct test_nocrash7 * test_nocrash8;
923 
924 // We used to crash on this.
925 
926 // expected-warning@+1 {{unknown command tag name}}
927 /// aaa \unknown aaa \unknown aaa
928 int test_nocrash9;
929 
930 // We used to crash on this.  PR15068
931 
932 // expected-warning@+2 {{empty paragraph passed to '@param' command}}
933 // expected-warning@+2 {{empty paragraph passed to '@param' command}}
934 ///@param x
935 ///@param y
936 int test_nocrash10(int x, int y);
937 
938 // expected-warning@+2 {{empty paragraph passed to '@param' command}} expected-warning@+2 {{parameter 'x' not found in the function declaration}}
939 // expected-warning@+2 {{empty paragraph passed to '@param' command}} expected-warning@+2 {{parameter 'y' not found in the function declaration}}
940 ///@param x
941 ///@param y
942 int test_nocrash11();
943 
944 // expected-warning@+3 {{empty paragraph passed to '@param' command}} expected-warning@+3 {{parameter 'x' not found in the function declaration}}
945 // expected-warning@+3 {{empty paragraph passed to '@param' command}} expected-warning@+3 {{parameter 'y' not found in the function declaration}}
946 /**
947 @param x
948 @param y
949 **/
950 int test_nocrash12();
951 
952 // expected-warning@+2 {{empty paragraph passed to '@param' command}}
953 // expected-warning@+1 {{empty paragraph passed to '@param' command}}
954 ///@param x@param y
955 int test_nocrash13(int x, int y);
956 
957 // rdar://12379114
958 // expected-warning@+2 {{'@union' command should not be used in a comment attached to a non-union declaration}}
959 /*!
960    @union U This is new
961 */
962 struct U { int iS; };
963 
964 /*!
965   @union U1
966 */
967 union U1 {int i; };
968 
969 // expected-warning@+2 {{'@struct' command should not be used in a comment attached to a non-struct declaration}}
970 /*!
971  @struct S2
972 */
973 union S2 {};
974 
975 /*!
976   @class C1
977 */
978 class C1;
979 
980 /*!
981   @struct S3;
982 */
983 class S3;
984 
985 // rdar://14124702
986 //----------------------------------------------------------------------
987 /// @class Predicate Predicate.h "lldb/Host/Predicate.h"
988 /// @brief A C++ wrapper class for providing threaded access to a value
989 /// of type T.
990 ///
991 /// A templatized class.
992 /// specified values.
993 //----------------------------------------------------------------------
994 template <class T, class T1>
995 class Predicate
996 {
997 };
998 
999 //----------------------------------------------------------------------
1000 /// @class Predicate<int, char> Predicate.h "lldb/Host/Predicate.h"
1001 /// @brief A C++ wrapper class for providing threaded access to a value
1002 /// of type T.
1003 ///
1004 /// A template specilization class.
1005 //----------------------------------------------------------------------
1006 template<> class Predicate<int, char>
1007 {
1008 };
1009 
1010 //----------------------------------------------------------------------
1011 /// @class Predicate<T, int> Predicate.h "lldb/Host/Predicate.h"
1012 /// @brief A C++ wrapper class for providing threaded access to a value
1013 /// of type T.
1014 ///
1015 /// A partial specialization template class.
1016 //----------------------------------------------------------------------
1017 template<class T> class Predicate<T, int>
1018 {
1019 };
1020 
1021 /*!     @function test_function
1022 */
1023 template <class T> T test_function (T arg);
1024 
1025 /*!     @function test_function<int>
1026 */
1027 template <> int test_function<int> (int arg);
1028