Dmitri Gribenko | a5ef44f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -Wdocumentation -Wdocumentation-pedantic -verify %s |
| 2 | |
| 3 | // expected-warning@+1 {{expected quoted string after equals sign}} |
| 4 | /// <a href=> |
| 5 | int test_html1(int); |
| 6 | |
| 7 | // expected-warning@+1 {{expected quoted string after equals sign}} |
| 8 | /// <a href==> |
| 9 | int test_html2(int); |
| 10 | |
| 11 | // expected-warning@+2 {{expected quoted string after equals sign}} |
Dmitri Gribenko | 3f38bf2 | 2012-07-13 00:44:24 +0000 | [diff] [blame] | 12 | // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}} |
Dmitri Gribenko | a5ef44f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 13 | /// <a href= blah |
| 14 | int test_html3(int); |
| 15 | |
Dmitri Gribenko | 3f38bf2 | 2012-07-13 00:44:24 +0000 | [diff] [blame] | 16 | // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}} |
Dmitri Gribenko | a5ef44f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 17 | /// <a => |
| 18 | int test_html4(int); |
| 19 | |
Dmitri Gribenko | 3f38bf2 | 2012-07-13 00:44:24 +0000 | [diff] [blame] | 20 | // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}} |
Dmitri Gribenko | a5ef44f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 21 | /// <a "aaa"> |
| 22 | int test_html5(int); |
| 23 | |
Dmitri Gribenko | 3f38bf2 | 2012-07-13 00:44:24 +0000 | [diff] [blame] | 24 | // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}} |
Dmitri Gribenko | a5ef44f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 25 | /// <a a="b" => |
| 26 | int test_html6(int); |
| 27 | |
Dmitri Gribenko | 3f38bf2 | 2012-07-13 00:44:24 +0000 | [diff] [blame] | 28 | // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}} |
Dmitri Gribenko | a5ef44f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 29 | /// <a a="b" "aaa"> |
| 30 | int test_html7(int); |
| 31 | |
Dmitri Gribenko | 3f38bf2 | 2012-07-13 00:44:24 +0000 | [diff] [blame] | 32 | // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}} |
Dmitri Gribenko | a5ef44f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 33 | /// <a a="b" = |
| 34 | int test_html8(int); |
| 35 | |
Dmitri Gribenko | 3f38bf2 | 2012-07-13 00:44:24 +0000 | [diff] [blame] | 36 | // expected-warning@+2 {{HTML start tag prematurely ended, expected attribute name or '>'}} expected-note@+1 {{HTML tag started here}} |
Dmitri Gribenko | a5ef44f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 37 | /** Aaa bbb<ccc ddd eee |
| 38 | * fff ggg. |
| 39 | */ |
| 40 | int test_html9(int); |
| 41 | |
Dmitri Gribenko | 3f38bf2 | 2012-07-13 00:44:24 +0000 | [diff] [blame] | 42 | // expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}} |
Dmitri Gribenko | a5ef44f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 43 | /** Aaa bbb<ccc ddd eee 42% |
| 44 | * fff ggg. |
| 45 | */ |
| 46 | int test_html10(int); |
| 47 | |
Dmitri Gribenko | 3f38bf2 | 2012-07-13 00:44:24 +0000 | [diff] [blame] | 48 | // expected-warning@+1 {{HTML end tag 'br' is forbidden}} |
Dmitri Gribenko | 3d98698 | 2012-07-12 23:37:09 +0000 | [diff] [blame] | 49 | /// <br></br> |
| 50 | int test_html11(int); |
Dmitri Gribenko | a5ef44f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 51 | |
| 52 | /// <blockquote>Meow</blockquote> |
| 53 | int test_html_nesting1(int); |
| 54 | |
| 55 | /// <b><i>Meow</i></b> |
| 56 | int test_html_nesting2(int); |
| 57 | |
| 58 | /// <p>Aaa<br> |
| 59 | /// Bbb</p> |
| 60 | int test_html_nesting3(int); |
| 61 | |
| 62 | /// <p>Aaa<br /> |
| 63 | /// Bbb</p> |
| 64 | int test_html_nesting4(int); |
| 65 | |
Dmitri Gribenko | 3f38bf2 | 2012-07-13 00:44:24 +0000 | [diff] [blame] | 66 | // expected-warning@+1 {{HTML end tag does not match any start tag}} |
Dmitri Gribenko | a5ef44f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 67 | /// <b><i>Meow</a> |
| 68 | int test_html_nesting5(int); |
| 69 | |
Dmitri Gribenko | 3f38bf2 | 2012-07-13 00:44:24 +0000 | [diff] [blame] | 70 | // expected-warning@+2 {{HTML start tag 'i' closed by 'b'}} |
| 71 | // expected-warning@+1 {{HTML end tag does not match any start tag}} |
Dmitri Gribenko | a5ef44f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 72 | /// <b><i>Meow</b></b> |
| 73 | int test_html_nesting6(int); |
| 74 | |
Dmitri Gribenko | 3f38bf2 | 2012-07-13 00:44:24 +0000 | [diff] [blame] | 75 | // expected-warning@+2 {{HTML start tag 'i' closed by 'b'}} |
| 76 | // expected-warning@+1 {{HTML end tag does not match any start tag}} |
Dmitri Gribenko | a5ef44f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 77 | /// <b><i>Meow</b></i> |
| 78 | int test_html_nesting7(int); |
| 79 | |
| 80 | |
| 81 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 82 | /// \brief\brief Aaa |
| 83 | int test_block_command1(int); |
| 84 | |
| 85 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 86 | /// \brief \brief Aaa |
| 87 | int test_block_command2(int); |
| 88 | |
| 89 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 90 | /// \brief |
| 91 | /// \brief Aaa |
| 92 | int test_block_command3(int); |
| 93 | |
| 94 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 95 | /// \brief |
| 96 | /// |
| 97 | /// \brief Aaa |
| 98 | int test_block_command4(int); |
| 99 | |
| 100 | // There is trailing whitespace on one of the following lines, don't remove it! |
| 101 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 102 | /// \brief |
| 103 | /// |
| 104 | /// \brief Aaa |
| 105 | int test_block_command5(int); |
| 106 | |
Dmitri Gribenko | 858e69f | 2012-07-19 00:01:56 +0000 | [diff] [blame] | 107 | /// \brief \c Aaa |
| 108 | int test_block_command6(int); |
| 109 | |
Dmitri Gribenko | a5ef44f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 110 | // expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}} |
| 111 | /// \param a Blah blah. |
| 112 | int test_param1; |
| 113 | |
| 114 | // expected-warning@+1 {{empty paragraph passed to '\param' command}} |
| 115 | /// \param |
| 116 | /// \param a Blah blah. |
| 117 | int test_param2(int a); |
| 118 | |
| 119 | // expected-warning@+1 {{empty paragraph passed to '\param' command}} |
| 120 | /// \param a |
| 121 | int test_param3(int a); |
| 122 | |
| 123 | /// \param a Blah blah. |
| 124 | int test_param4(int a); |
| 125 | |
| 126 | /// \param [in] a Blah blah. |
| 127 | int test_param5(int a); |
| 128 | |
| 129 | /// \param [out] a Blah blah. |
| 130 | int test_param6(int a); |
| 131 | |
| 132 | /// \param [in,out] a Blah blah. |
| 133 | int test_param7(int a); |
| 134 | |
| 135 | // expected-warning@+1 {{whitespace is not allowed in parameter passing direction}} |
| 136 | /// \param [ in ] a Blah blah. |
| 137 | int test_param8(int a); |
| 138 | |
| 139 | // expected-warning@+1 {{whitespace is not allowed in parameter passing direction}} |
| 140 | /// \param [in, out] a Blah blah. |
| 141 | int test_param9(int a); |
| 142 | |
| 143 | // expected-warning@+1 {{unrecognized parameter passing direction, valid directions are '[in]', '[out]' and '[in,out]'}} |
| 144 | /// \param [ junk] a Blah blah. |
| 145 | int test_param10(int a); |
| 146 | |
Dmitri Gribenko | 2e72104 | 2012-07-24 21:56:59 +0000 | [diff] [blame^] | 147 | // expected-warning@+1 {{parameter 'a' not found in the function declaration}} |
Dmitri Gribenko | 56bf6fd | 2012-07-24 21:46:24 +0000 | [diff] [blame] | 148 | /// \param a Blah blah. |
| 149 | int test_param11(); |
| 150 | |
Dmitri Gribenko | a5ef44f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 151 | // expected-warning@+1 {{parameter 'A' not found in the function declaration}} expected-note@+1 {{did you mean 'a'?}} |
| 152 | /// \param A Blah blah. |
Dmitri Gribenko | 56bf6fd | 2012-07-24 21:46:24 +0000 | [diff] [blame] | 153 | int test_param12(int a); |
Dmitri Gribenko | a5ef44f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 154 | |
| 155 | // expected-warning@+1 {{parameter 'aab' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}} |
| 156 | /// \param aab Blah blah. |
Dmitri Gribenko | 56bf6fd | 2012-07-24 21:46:24 +0000 | [diff] [blame] | 157 | int test_param13(int aaa, int bbb); |
Dmitri Gribenko | a5ef44f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 158 | |
| 159 | // expected-warning@+1 {{parameter 'aab' not found in the function declaration}} |
| 160 | /// \param aab Blah blah. |
Dmitri Gribenko | 56bf6fd | 2012-07-24 21:46:24 +0000 | [diff] [blame] | 161 | int test_param14(int bbb, int ccc); |
Dmitri Gribenko | a5ef44f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 162 | |
| 163 | class C { |
| 164 | // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}} |
| 165 | /// \param aaa Blah blah. |
| 166 | C(int bbb, int ccc); |
| 167 | |
| 168 | // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}} |
| 169 | /// \param aaa Blah blah. |
Dmitri Gribenko | 56bf6fd | 2012-07-24 21:46:24 +0000 | [diff] [blame] | 170 | int test_param15(int bbb, int ccc); |
Dmitri Gribenko | a5ef44f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 171 | }; |
| 172 | |
Dmitri Gribenko | 6582277 | 2012-07-24 21:44:16 +0000 | [diff] [blame] | 173 | // expected-warning@+3 {{parameter 'a' is already documented}} |
| 174 | // expected-note@+1 {{previous documentation}} |
| 175 | /// \param a Aaa. |
| 176 | /// \param a Aaa. |
Dmitri Gribenko | 56bf6fd | 2012-07-24 21:46:24 +0000 | [diff] [blame] | 177 | int test_param16(int a); |
Dmitri Gribenko | 6582277 | 2012-07-24 21:44:16 +0000 | [diff] [blame] | 178 | |
| 179 | // expected-warning@+4 {{parameter 'x2' is already documented}} |
| 180 | // expected-note@+2 {{previous documentation}} |
| 181 | /// \param x1 Aaa. |
| 182 | /// \param x2 Bbb. |
| 183 | /// \param x2 Ccc. |
Dmitri Gribenko | 56bf6fd | 2012-07-24 21:46:24 +0000 | [diff] [blame] | 184 | int test_param17(int x1, int x2, int x3); |
Dmitri Gribenko | a5ef44f | 2012-07-11 21:38:39 +0000 | [diff] [blame] | 185 | |
| 186 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 187 | int test1; ///< \brief\brief Aaa |
| 188 | |
| 189 | // expected-warning@+2 {{empty paragraph passed to '\brief' command}} |
| 190 | // expected-warning@+2 {{empty paragraph passed to '\brief' command}} |
| 191 | int test2, ///< \brief\brief Aaa |
| 192 | test3; ///< \brief\brief Aaa |
| 193 | |
| 194 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 195 | int test4; ///< \brief |
| 196 | ///< \brief Aaa |
| 197 | |
| 198 | |
| 199 | // Check that we attach the comment to the declaration during parsing in the |
| 200 | // following cases. The test is based on the fact that we don't parse |
| 201 | // documentation comments that are not attached to anything. |
| 202 | |
| 203 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 204 | /// \brief\brief Aaa |
| 205 | int test_attach1; |
| 206 | |
| 207 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 208 | /// \brief\brief Aaa |
| 209 | int test_attach2(int); |
| 210 | |
| 211 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 212 | /// \brief\brief Aaa |
| 213 | struct test_attach3 { |
| 214 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 215 | /// \brief\brief Aaa |
| 216 | int test_attach4; |
| 217 | |
| 218 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 219 | int test_attach5; ///< \brief\brief Aaa |
| 220 | |
| 221 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 222 | /// \brief\brief Aaa |
| 223 | int test_attach6(int); |
| 224 | }; |
| 225 | |
| 226 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 227 | /// \brief\brief Aaa |
| 228 | class test_attach7 { |
| 229 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 230 | /// \brief\brief Aaa |
| 231 | int test_attach8; |
| 232 | |
| 233 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 234 | int test_attach9; ///< \brief\brief Aaa |
| 235 | |
| 236 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 237 | /// \brief\brief Aaa |
| 238 | int test_attach10(int); |
| 239 | }; |
| 240 | |
| 241 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 242 | /// \brief\brief Aaa |
| 243 | enum test_attach9 { |
| 244 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 245 | /// \brief\brief Aaa |
| 246 | test_attach10, |
| 247 | |
| 248 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 249 | test_attach11 ///< \brief\brief Aaa |
| 250 | }; |
| 251 | |
| 252 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 253 | /// \brief\brief Aaa |
| 254 | struct test_noattach12 *test_attach13; |
| 255 | |
| 256 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 257 | /// \brief\brief Aaa |
| 258 | typedef struct test_noattach14 *test_attach15; |
| 259 | |
| 260 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 261 | /// \brief\brief Aaa |
| 262 | typedef struct test_attach16 { int a; } test_attach17; |
| 263 | |
| 264 | struct S { int a; }; |
| 265 | |
| 266 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 267 | /// \brief\brief Aaa |
| 268 | struct S *test_attach18; |
| 269 | |
| 270 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 271 | /// \brief\brief Aaa |
| 272 | typedef struct S *test_attach19; |
| 273 | |
| 274 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 275 | /// \brief\brief Aaa |
| 276 | struct test_attach20; |
| 277 | |
| 278 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 279 | /// \brief\brief Aaa |
| 280 | typedef struct test_attach21 { |
| 281 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 282 | /// \brief\brief Aaa |
| 283 | int test_attach22; |
| 284 | } test_attach23; |
| 285 | |
| 286 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 287 | /// \brief\brief Aaa |
| 288 | namespace test_attach24 { |
| 289 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 290 | /// \brief\brief Aaa |
| 291 | namespace test_attach25 { |
| 292 | } |
| 293 | } |
| 294 | |
Dmitri Gribenko | 9f08f49 | 2012-07-20 20:18:53 +0000 | [diff] [blame] | 295 | // PR13411, reduced. We used to crash on this. |
| 296 | /** |
| 297 | * @code Aaa. |
| 298 | */ |
| 299 | void test_nocrash1(int); |
| 300 | |