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 | |
| 147 | // expected-warning@+1 {{parameter 'A' not found in the function declaration}} expected-note@+1 {{did you mean 'a'?}} |
| 148 | /// \param A Blah blah. |
| 149 | int test_param11(int a); |
| 150 | |
| 151 | // expected-warning@+1 {{parameter 'aab' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}} |
| 152 | /// \param aab Blah blah. |
| 153 | int test_param12(int aaa, int bbb); |
| 154 | |
| 155 | // expected-warning@+1 {{parameter 'aab' not found in the function declaration}} |
| 156 | /// \param aab Blah blah. |
| 157 | int test_param13(int bbb, int ccc); |
| 158 | |
| 159 | class C { |
| 160 | // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}} |
| 161 | /// \param aaa Blah blah. |
| 162 | C(int bbb, int ccc); |
| 163 | |
| 164 | // expected-warning@+1 {{parameter 'aaa' not found in the function declaration}} |
| 165 | /// \param aaa Blah blah. |
| 166 | int test_param14(int bbb, int ccc); |
| 167 | }; |
| 168 | |
| 169 | |
| 170 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 171 | int test1; ///< \brief\brief Aaa |
| 172 | |
| 173 | // expected-warning@+2 {{empty paragraph passed to '\brief' command}} |
| 174 | // expected-warning@+2 {{empty paragraph passed to '\brief' command}} |
| 175 | int test2, ///< \brief\brief Aaa |
| 176 | test3; ///< \brief\brief Aaa |
| 177 | |
| 178 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 179 | int test4; ///< \brief |
| 180 | ///< \brief Aaa |
| 181 | |
| 182 | |
| 183 | // Check that we attach the comment to the declaration during parsing in the |
| 184 | // following cases. The test is based on the fact that we don't parse |
| 185 | // documentation comments that are not attached to anything. |
| 186 | |
| 187 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 188 | /// \brief\brief Aaa |
| 189 | int test_attach1; |
| 190 | |
| 191 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 192 | /// \brief\brief Aaa |
| 193 | int test_attach2(int); |
| 194 | |
| 195 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 196 | /// \brief\brief Aaa |
| 197 | struct test_attach3 { |
| 198 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 199 | /// \brief\brief Aaa |
| 200 | int test_attach4; |
| 201 | |
| 202 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 203 | int test_attach5; ///< \brief\brief Aaa |
| 204 | |
| 205 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 206 | /// \brief\brief Aaa |
| 207 | int test_attach6(int); |
| 208 | }; |
| 209 | |
| 210 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 211 | /// \brief\brief Aaa |
| 212 | class test_attach7 { |
| 213 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 214 | /// \brief\brief Aaa |
| 215 | int test_attach8; |
| 216 | |
| 217 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 218 | int test_attach9; ///< \brief\brief Aaa |
| 219 | |
| 220 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 221 | /// \brief\brief Aaa |
| 222 | int test_attach10(int); |
| 223 | }; |
| 224 | |
| 225 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 226 | /// \brief\brief Aaa |
| 227 | enum test_attach9 { |
| 228 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 229 | /// \brief\brief Aaa |
| 230 | test_attach10, |
| 231 | |
| 232 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 233 | test_attach11 ///< \brief\brief Aaa |
| 234 | }; |
| 235 | |
| 236 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 237 | /// \brief\brief Aaa |
| 238 | struct test_noattach12 *test_attach13; |
| 239 | |
| 240 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 241 | /// \brief\brief Aaa |
| 242 | typedef struct test_noattach14 *test_attach15; |
| 243 | |
| 244 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 245 | /// \brief\brief Aaa |
| 246 | typedef struct test_attach16 { int a; } test_attach17; |
| 247 | |
| 248 | struct S { int a; }; |
| 249 | |
| 250 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 251 | /// \brief\brief Aaa |
| 252 | struct S *test_attach18; |
| 253 | |
| 254 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 255 | /// \brief\brief Aaa |
| 256 | typedef struct S *test_attach19; |
| 257 | |
| 258 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 259 | /// \brief\brief Aaa |
| 260 | struct test_attach20; |
| 261 | |
| 262 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 263 | /// \brief\brief Aaa |
| 264 | typedef struct test_attach21 { |
| 265 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 266 | /// \brief\brief Aaa |
| 267 | int test_attach22; |
| 268 | } test_attach23; |
| 269 | |
| 270 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 271 | /// \brief\brief Aaa |
| 272 | namespace test_attach24 { |
| 273 | // expected-warning@+1 {{empty paragraph passed to '\brief' command}} |
| 274 | /// \brief\brief Aaa |
| 275 | namespace test_attach25 { |
| 276 | } |
| 277 | } |
| 278 | |
Dmitri Gribenko | 9f08f49 | 2012-07-20 20:18:53 +0000 | [diff] [blame^] | 279 | // PR13411, reduced. We used to crash on this. |
| 280 | /** |
| 281 | * @code Aaa. |
| 282 | */ |
| 283 | void test_nocrash1(int); |
| 284 | |