/external/clang/test/Sema/warn-documentation.cpp

https://gitlab.com/brian0218/rk3188_r-box_android4.2.2_sdk · C++ · 763 lines · 226 code · 154 blank · 383 comment · 0 complexity · 72b2d532e0afdbe54b1d2a765c3781d0 MD5 · raw file

  1. // RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wdocumentation -Wdocumentation-pedantic -verify %s
  2. // This file contains lots of corner cases, so ensure that XML we generate is not invalid.
  3. // RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s | FileCheck %s -check-prefix=WRONG
  4. // WRONG-NOT: CommentXMLInvalid
  5. // expected-warning@+1 {{expected quoted string after equals sign}}
  6. /// <a href=>
  7. int test_html1(int);
  8. // expected-warning@+1 {{expected quoted string after equals sign}}
  9. /// <a href==>
  10. int test_html2(int);
  11. // expected-warning@+2 {{expected quoted string after equals sign}}
  12. // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
  13. /// <a href= blah
  14. int test_html3(int);
  15. // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
  16. /// <a =>
  17. int test_html4(int);
  18. // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
  19. /// <a "aaa">
  20. int test_html5(int);
  21. // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
  22. /// <a a="b" =>
  23. int test_html6(int);
  24. // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
  25. /// <a a="b" "aaa">
  26. int test_html7(int);
  27. // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
  28. /// <a a="b" =
  29. int test_html8(int);
  30. // expected-warning@+2 {{HTML start tag prematurely ended, expected attribute name or '>'}} expected-note@+1 {{HTML tag started here}}
  31. /** Aaa bbb<img ddd eee
  32. * fff ggg.
  33. */
  34. int test_html9(int);
  35. // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
  36. /** Aaa bbb<img ddd eee 42%
  37. * fff ggg.
  38. */
  39. int test_html10(int);
  40. // expected-warning@+1 {{HTML end tag 'br' is forbidden}}
  41. /// <br></br>
  42. int test_html11(int);
  43. /// <blockquote>Meow</blockquote>
  44. int test_html_nesting1(int);
  45. /// <b><i>Meow</i></b>
  46. int test_html_nesting2(int);
  47. /// <p>Aaa<br>
  48. /// Bbb</p>
  49. int test_html_nesting3(int);
  50. /// <p>Aaa<br />
  51. /// Bbb</p>
  52. int test_html_nesting4(int);
  53. // expected-warning@+1 {{HTML end tag does not match any start tag}}
  54. /// <b><i>Meow</a>
  55. int test_html_nesting5(int);
  56. // expected-warning@+2 {{HTML start tag 'i' closed by 'b'}}
  57. // expected-warning@+1 {{HTML end tag does not match any start tag}}
  58. /// <b><i>Meow</b></b>
  59. int test_html_nesting6(int);
  60. // expected-warning@+2 {{HTML start tag 'i' closed by 'b'}}
  61. // expected-warning@+1 {{HTML end tag does not match any start tag}}
  62. /// <b><i>Meow</b></i>
  63. int test_html_nesting7(int);
  64. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  65. /// \brief\returns Aaa
  66. int test_block_command1(int);
  67. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  68. /// \brief \returns Aaa
  69. int test_block_command2(int);
  70. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  71. /// \brief
  72. /// \returns Aaa
  73. int test_block_command3(int);
  74. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  75. /// \brief
  76. ///
  77. /// \returns Aaa
  78. int test_block_command4(int);
  79. // There is trailing whitespace on one of the following lines, don't remove it!
  80. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  81. /// \brief
  82. ///
  83. /// \returns Aaa
  84. int test_block_command5(int);
  85. /// \brief \c Aaa
  86. int test_block_command6(int);
  87. // expected-warning@+5 {{duplicated command '\brief'}} expected-note@+1 {{previous command '\brief' here}}
  88. /// \brief Aaa
  89. ///
  90. /// Bbb
  91. ///
  92. /// \brief Ccc
  93. int test_duplicate_brief1(int);
  94. // expected-warning@+5 {{duplicated command '\short'}} expected-note@+1 {{previous command '\short' here}}
  95. /// \short Aaa
  96. ///
  97. /// Bbb
  98. ///
  99. /// \short Ccc
  100. int test_duplicate_brief2(int);
  101. // expected-warning@+5 {{duplicated command '\brief'}} expected-note@+1 {{previous command '\short' (an alias of '\brief') here}}
  102. /// \short Aaa
  103. ///
  104. /// Bbb
  105. ///
  106. /// \brief Ccc
  107. int test_duplicate_brief3(int);
  108. // expected-warning@+5 {{duplicated command '\return'}} expected-note@+1 {{previous command '\return' here}}
  109. /// \return Aaa
  110. ///
  111. /// Bbb
  112. ///
  113. /// \return Ccc
  114. int test_duplicate_returns1(int);
  115. // expected-warning@+5 {{duplicated command '\returns'}} expected-note@+1 {{previous command '\returns' here}}
  116. /// \returns Aaa
  117. ///
  118. /// Bbb
  119. ///
  120. /// \returns Ccc
  121. int test_duplicate_returns2(int);
  122. // expected-warning@+5 {{duplicated command '\result'}} expected-note@+1 {{previous command '\result' here}}
  123. /// \result Aaa
  124. ///
  125. /// Bbb
  126. ///
  127. /// \result Ccc
  128. int test_duplicate_returns3(int);
  129. // expected-warning@+5 {{duplicated command '\return'}} expected-note@+1 {{previous command '\returns' (an alias of '\return') here}}
  130. /// \returns Aaa
  131. ///
  132. /// Bbb
  133. ///
  134. /// \return Ccc
  135. int test_duplicate_returns4(int);
  136. // expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
  137. /// \param a Blah blah.
  138. int test_param1;
  139. // expected-warning@+1 {{empty paragraph passed to '\param' command}}
  140. /// \param
  141. /// \param a Blah blah.
  142. int test_param2(int a);
  143. // expected-warning@+1 {{empty paragraph passed to '\param' command}}
  144. /// \param a
  145. int test_param3(int a);
  146. /// \param a Blah blah.
  147. int test_param4(int a);
  148. /// \param [in] a Blah blah.
  149. int test_param5(int a);
  150. /// \param [out] a Blah blah.
  151. int test_param6(int a);
  152. /// \param [in,out] a Blah blah.
  153. int test_param7(int a);
  154. // expected-warning@+1 {{whitespace is not allowed in parameter passing direction}}
  155. /// \param [ in ] a Blah blah.
  156. int test_param8(int a);
  157. // expected-warning@+1 {{whitespace is not allowed in parameter passing direction}}
  158. /// \param [in, out] a Blah blah.
  159. int test_param9(int a);
  160. // expected-warning@+1 {{unrecognized parameter passing direction, valid directions are '[in]', '[out]' and '[in,out]'}}
  161. /// \param [ junk] a Blah blah.
  162. int test_param10(int a);
  163. // expected-warning@+1 {{parameter 'a' not found in the function declaration}}
  164. /// \param a Blah blah.
  165. int test_param11();
  166. // expected-warning@+1 {{parameter 'A' not found in the function declaration}} expected-note@+1 {{did you mean 'a'?}}
  167. /// \param A Blah blah.
  168. int test_param12(int a);
  169. // expected-warning@+1 {{parameter 'aab' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
  170. /// \param aab Blah blah.
  171. int test_param13(int aaa, int bbb);
  172. // expected-warning@+2 {{parameter 'aab' not found in the function declaration}} expected-note@+2 {{did you mean 'bbb'?}}
  173. /// \param aaa Blah blah.
  174. /// \param aab Blah blah.
  175. int test_param14(int aaa, int bbb);
  176. // expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
  177. /// \param aab Blah blah.
  178. int test_param15(int bbb, int ccc);
  179. // expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
  180. /// \param aab Ccc.
  181. /// \param aaa Aaa.
  182. /// \param bbb Bbb.
  183. int test_param16(int aaa, int bbb);
  184. // expected-warning@+2 {{parameter 'aab' not found in the function declaration}}
  185. /// \param aaa Aaa.
  186. /// \param aab Ccc.
  187. /// \param bbb Bbb.
  188. int test_param17(int aaa, int bbb);
  189. // expected-warning@+3 {{parameter 'aab' not found in the function declaration}}
  190. /// \param aaa Aaa.
  191. /// \param bbb Bbb.
  192. /// \param aab Ccc.
  193. int test_param18(int aaa, int bbb);
  194. class C {
  195. // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}}
  196. /// \param aaa Blah blah.
  197. C(int bbb, int ccc);
  198. // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}}
  199. /// \param aaa Blah blah.
  200. int test_param19(int bbb, int ccc);
  201. };
  202. // expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
  203. /// \param aab Blah blah.
  204. template<typename T>
  205. void test_param20(int bbb, int ccc);
  206. // expected-warning@+3 {{parameter 'a' is already documented}}
  207. // expected-note@+1 {{previous documentation}}
  208. /// \param a Aaa.
  209. /// \param a Aaa.
  210. int test_param21(int a);
  211. // expected-warning@+4 {{parameter 'x2' is already documented}}
  212. // expected-note@+2 {{previous documentation}}
  213. /// \param x1 Aaa.
  214. /// \param x2 Bbb.
  215. /// \param x2 Ccc.
  216. int test_param22(int x1, int x2, int x3);
  217. // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
  218. /// \param aaa Meow.
  219. /// \param bbb Bbb.
  220. /// \returns aaa.
  221. typedef int test_param23(int aaa, int ccc);
  222. // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
  223. /// \param aaa Meow.
  224. /// \param bbb Bbb.
  225. /// \returns aaa.
  226. typedef int (*test_param24)(int aaa, int ccc);
  227. // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
  228. /// \param aaa Meow.
  229. /// \param bbb Bbb.
  230. /// \returns aaa.
  231. typedef int (* const test_param25)(int aaa, int ccc);
  232. // expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
  233. /// \param aaa Meow.
  234. /// \param bbb Bbb.
  235. /// \returns aaa.
  236. typedef int (C::*test_param26)(int aaa, int ccc);
  237. // expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
  238. /// \tparam T Aaa
  239. int test_tparam1;
  240. // expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
  241. /// \tparam T Aaa
  242. void test_tparam2(int aaa);
  243. // expected-warning@+1 {{empty paragraph passed to '\tparam' command}}
  244. /// \tparam
  245. /// \param aaa Blah blah
  246. template<typename T>
  247. void test_tparam3(T aaa);
  248. // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TT'?}}
  249. /// \tparam T Aaa
  250. template<typename TT>
  251. void test_tparam4(TT aaa);
  252. // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TT'?}}
  253. /// \tparam T Aaa
  254. template<typename TT>
  255. class test_tparam5 {
  256. // expected-warning@+1 {{template parameter 'T' not found in the template declaration}} expected-note@+1 {{did you mean 'TTT'?}}
  257. /// \tparam T Aaa
  258. template<typename TTT>
  259. void test_tparam6(TTT aaa);
  260. };
  261. /// \tparam T1 Aaa
  262. /// \tparam T2 Bbb
  263. template<typename T1, typename T2>
  264. void test_tparam7(T1 aaa, T2 bbb);
  265. // expected-warning@+1 {{template parameter 'SomTy' not found in the template declaration}} expected-note@+1 {{did you mean 'SomeTy'?}}
  266. /// \tparam SomTy Aaa
  267. /// \tparam OtherTy Bbb
  268. template<typename SomeTy, typename OtherTy>
  269. void test_tparam8(SomeTy aaa, OtherTy bbb);
  270. // expected-warning@+2 {{template parameter 'T1' is already documented}} expected-note@+1 {{previous documentation}}
  271. /// \tparam T1 Aaa
  272. /// \tparam T1 Bbb
  273. template<typename T1, typename T2>
  274. void test_tparam9(T1 aaa, T2 bbb);
  275. /// \tparam T Aaa
  276. /// \tparam TT Bbb
  277. template<template<typename T> class TT>
  278. void test_tparam10(TT<int> aaa);
  279. /// \tparam T Aaa
  280. /// \tparam TT Bbb
  281. /// \tparam TTT Ccc
  282. template<template<template<typename T> class TT, class C> class TTT>
  283. void test_tparam11();
  284. /// \tparam I Aaa
  285. template<int I>
  286. void test_tparam12();
  287. template<typename T, typename U>
  288. class test_tparam13 { };
  289. /// \tparam T Aaa
  290. template<typename T>
  291. using test_tparam14 = test_tparam13<T, int>;
  292. // expected-warning@+1 {{template parameter 'U' not found in the template declaration}} expected-note@+1 {{did you mean 'T'?}}
  293. /// \tparam U Aaa
  294. template<typename T>
  295. using test_tparam15 = test_tparam13<T, int>;
  296. // no-warning
  297. /// \returns Aaa
  298. int test_returns_right_decl_1(int);
  299. class test_returns_right_decl_2 {
  300. // no-warning
  301. /// \returns Aaa
  302. int test_returns_right_decl_3(int);
  303. };
  304. // no-warning
  305. /// \returns Aaa
  306. template<typename T>
  307. int test_returns_right_decl_4(T aaa);
  308. // no-warning
  309. /// \returns Aaa
  310. template<>
  311. int test_returns_right_decl_4(int aaa);
  312. /// \returns Aaa
  313. template<typename T>
  314. T test_returns_right_decl_5(T aaa);
  315. // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
  316. /// \returns Aaa
  317. int test_returns_wrong_decl_1;
  318. // expected-warning@+1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
  319. /// \return Aaa
  320. int test_returns_wrong_decl_2;
  321. // expected-warning@+1 {{'\result' command used in a comment that is not attached to a function or method declaration}}
  322. /// \result Aaa
  323. int test_returns_wrong_decl_3;
  324. // expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
  325. /// \returns Aaa
  326. void test_returns_wrong_decl_4(int);
  327. // expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
  328. /// \returns Aaa
  329. template<typename T>
  330. void test_returns_wrong_decl_5(T aaa);
  331. // expected-warning@+1 {{'\returns' command used in a comment that is attached to a function returning void}}
  332. /// \returns Aaa
  333. template<>
  334. void test_returns_wrong_decl_5(int aaa);
  335. // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
  336. /// \returns Aaa
  337. struct test_returns_wrong_decl_6 { };
  338. // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
  339. /// \returns Aaa
  340. class test_returns_wrong_decl_7 {
  341. // expected-warning@+1 {{'\returns' command used in a comment that is attached to a constructor}}
  342. /// \returns Aaa
  343. test_returns_wrong_decl_7();
  344. // expected-warning@+1 {{'\returns' command used in a comment that is attached to a destructor}}
  345. /// \returns Aaa
  346. ~test_returns_wrong_decl_7();
  347. };
  348. // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
  349. /// \returns Aaa
  350. enum test_returns_wrong_decl_8 {
  351. // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
  352. /// \returns Aaa
  353. test_returns_wrong_decl_9
  354. };
  355. // expected-warning@+1 {{'\returns' command used in a comment that is not attached to a function or method declaration}}
  356. /// \returns Aaa
  357. namespace test_returns_wrong_decl_10 { };
  358. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  359. int test1; ///< \brief\author Aaa
  360. // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
  361. // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
  362. int test2, ///< \brief\author Aaa
  363. test3; ///< \brief\author Aaa
  364. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  365. int test4; ///< \brief
  366. ///< \author Aaa
  367. // Check that we attach the comment to the declaration during parsing in the
  368. // following cases. The test is based on the fact that we don't parse
  369. // documentation comments that are not attached to anything.
  370. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  371. /// \brief\author Aaa
  372. int test_attach1;
  373. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  374. /// \brief\author Aaa
  375. int test_attach2(int);
  376. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  377. /// \brief\author Aaa
  378. struct test_attach3 {
  379. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  380. /// \brief\author Aaa
  381. int test_attach4;
  382. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  383. int test_attach5; ///< \brief\author Aaa
  384. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  385. /// \brief\author Aaa
  386. int test_attach6(int);
  387. };
  388. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  389. /// \brief\author Aaa
  390. class test_attach7 {
  391. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  392. /// \brief\author Aaa
  393. int test_attach8;
  394. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  395. int test_attach9; ///< \brief\author Aaa
  396. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  397. /// \brief\author Aaa
  398. int test_attach10(int);
  399. };
  400. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  401. /// \brief\author Aaa
  402. enum test_attach9 {
  403. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  404. /// \brief\author Aaa
  405. test_attach10,
  406. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  407. test_attach11 ///< \brief\author Aaa
  408. };
  409. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  410. /// \brief\author Aaa
  411. struct test_noattach12 *test_attach13;
  412. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  413. /// \brief\author Aaa
  414. typedef struct test_noattach14 *test_attach15;
  415. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  416. /// \brief\author Aaa
  417. typedef struct test_attach16 { int a; } test_attach17;
  418. struct S { int a; };
  419. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  420. /// \brief\author Aaa
  421. struct S *test_attach18;
  422. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  423. /// \brief\author Aaa
  424. typedef struct S *test_attach19;
  425. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  426. /// \brief\author Aaa
  427. struct test_attach20;
  428. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  429. /// \brief\author Aaa
  430. typedef struct test_attach21 {
  431. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  432. /// \brief\author Aaa
  433. int test_attach22;
  434. } test_attach23;
  435. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  436. /// \brief\author Aaa
  437. namespace test_attach24 {
  438. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  439. /// \brief\author Aaa
  440. namespace test_attach25 {
  441. }
  442. }
  443. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  444. /// \brief\author Aaa
  445. /// \tparam T Aaa
  446. template<typename T>
  447. void test_attach26(T aaa);
  448. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  449. /// \brief\author Aaa
  450. /// \tparam T Aaa
  451. template<typename T, typename U>
  452. void test_attach27(T aaa, U bbb);
  453. // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
  454. // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
  455. /// \brief\author Aaa
  456. /// \tparam T Aaa
  457. template<>
  458. void test_attach27(int aaa, int bbb);
  459. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  460. /// \brief\author Aaa
  461. /// \tparam T Aaa
  462. template<typename T>
  463. class test_attach28 {
  464. T aaa;
  465. };
  466. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  467. /// \brief\author Aaa
  468. using test_attach29 = test_attach28<int>;
  469. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  470. /// \brief\author Aaa
  471. /// \tparam T Aaa
  472. template<typename T, typename U>
  473. class test_attach30 { };
  474. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  475. /// \brief\author Aaa
  476. /// \tparam T Aaa
  477. template<typename T>
  478. class test_attach30<T, int> { };
  479. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  480. /// \brief\author Aaa
  481. template<>
  482. class test_attach30<int, int> { };
  483. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  484. /// \brief\author Aaa
  485. template<typename T>
  486. using test_attach31 = test_attach30<T, int>;
  487. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  488. /// \brief\author Aaa
  489. /// \tparam T Aaa
  490. template<typename T, typename U, typename V>
  491. class test_attach32 { };
  492. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  493. /// \brief\author Aaa
  494. /// \tparam T Aaa
  495. template<typename T, typename U>
  496. class test_attach32<T, U, int> { };
  497. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  498. /// \brief\author Aaa
  499. /// \tparam T Aaa
  500. template<typename T>
  501. class test_attach32<T, int, int> { };
  502. // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
  503. // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
  504. /// \brief\author Aaa
  505. /// \tparam T Aaa
  506. template<>
  507. class test_attach32<int, int, int> { };
  508. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  509. /// \brief\author Aaa
  510. class test_attach33 {
  511. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  512. /// \brief\author Aaa
  513. /// \tparam T Aaa
  514. template<typename T, typename U>
  515. void test_attach34(T aaa, U bbb);
  516. };
  517. template<typename T>
  518. class test_attach35 {
  519. // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
  520. // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
  521. /// \brief\author Aaa
  522. /// \tparam T Aaa
  523. template<typename TT, typename UU>
  524. void test_attach36(TT aaa, UU bbb);
  525. };
  526. // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
  527. // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
  528. /// \brief\author Aaa
  529. /// \tparam T Aaa
  530. template<> template<>
  531. void test_attach35<int>::test_attach36(int aaa, int bbb) {}
  532. template<typename T>
  533. class test_attach37 {
  534. // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
  535. // expected-warning@+2 {{'\tparam' command used in a comment that is not attached to a template declaration}}
  536. /// \brief\author Aaa
  537. /// \tparam T Aaa
  538. void test_attach38(int aaa, int bbb);
  539. void test_attach39(int aaa, int bbb);
  540. };
  541. // expected-warning@+2 {{empty paragraph passed to '\brief' command}}
  542. // expected-warning@+2 {{template parameter 'T' not found in the template declaration}}
  543. /// \brief\author Aaa
  544. /// \tparam T Aaa
  545. template<>
  546. void test_attach37<int>::test_attach38(int aaa, int bbb) {}
  547. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  548. /// \brief\author Aaa
  549. /// \tparam T Aaa
  550. template<typename T>
  551. void test_attach37<T>::test_attach39(int aaa, int bbb) {}
  552. // We used to emit warning that parameter 'a' is not found because we parsed
  553. // the comment in context of the redeclaration which does not have parameter
  554. // names.
  555. template <typename T>
  556. struct test_attach38 {
  557. /*!
  558. \param a First param
  559. \param b Second param
  560. */
  561. template <typename B>
  562. void test_attach39(T a, B b);
  563. };
  564. template <>
  565. template <typename B>
  566. void test_attach38<int>::test_attach39(int, B);
  567. // PR13411, reduced. We used to crash on this.
  568. /**
  569. * @code Aaa.
  570. */
  571. void test_nocrash1(int);
  572. // We used to crash on this.
  573. // expected-warning@+2 {{empty paragraph passed to '\param' command}}
  574. // expected-warning@+1 {{empty paragraph passed to '\brief' command}}
  575. /// \param\brief
  576. void test_nocrash2(int);
  577. // PR13593, example 1 and 2
  578. /**
  579. * Bla.
  580. */
  581. template <typename>
  582. void test_nocrash3();
  583. /// Foo
  584. template <typename, typename>
  585. void test_nocrash4() { }
  586. template <typename>
  587. void test_nocrash3()
  588. {
  589. }
  590. // PR13593, example 3
  591. /**
  592. * aaa
  593. */
  594. template <typename T>
  595. inline T test_nocrash5(T a1)
  596. {
  597. return a1;
  598. }
  599. ///
  600. //,
  601. inline void test_nocrash6()
  602. {
  603. test_nocrash5(1);
  604. }
  605. // We used to crash on this.
  606. /*!
  607. Blah.
  608. */
  609. typedef const struct test_nocrash7 * test_nocrash8;