Commit 61cb485
committed
[clang-format] Keep the ObjC selector name and
Fixes #36459.
after
```Objective-C
- (void)test {
if ([object
respondsToSelector:@selector(
selectorNameThatIsReallyLong:param1:param2:)])
return;
}
```
before
```Objective-C
- (void)test {
if ([object respondsToSelector:@selector
(selectorNameThatIsReallyLong:param1:param2:)])
return;
}
```
Before this patch, the `ObjCMethodExpr` type was assigned to many kinds
of tokens. The rule for allowing breaking the line before the colon on
line TokenAnnotator.cpp:6290 was intended for method declarations and
calls. It matched the parenthesis following `@selector` by mistake. To
fix the problem, this patch adds a new type for `@selector`. Most of
the special things in the code related to the old type is intended for
other constructs. So most of the code related to the old type is not
changed in this patch.@selector together1 parent d45a135 commit 61cb485
File tree
5 files changed
+56
-12
lines changed- clang
- lib/Format
- unittests/Format
5 files changed
+56
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3199 | 3199 | | |
3200 | 3200 | | |
3201 | 3201 | | |
3202 | | - | |
| 3202 | + | |
3203 | 3203 | | |
3204 | 3204 | | |
3205 | 3205 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
130 | 134 | | |
| 135 | + | |
131 | 136 | | |
132 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
133 | 141 | | |
134 | 142 | | |
135 | 143 | | |
| |||
146 | 154 | | |
147 | 155 | | |
148 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
149 | 160 | | |
150 | 161 | | |
151 | 162 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
321 | 321 | | |
322 | 322 | | |
323 | 323 | | |
324 | | - | |
| 324 | + | |
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
330 | | - | |
| 330 | + | |
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
| |||
451 | 451 | | |
452 | 452 | | |
453 | 453 | | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
| 454 | + | |
| 455 | + | |
458 | 456 | | |
459 | 457 | | |
460 | 458 | | |
| |||
513 | 511 | | |
514 | 512 | | |
515 | 513 | | |
516 | | - | |
517 | | - | |
| 514 | + | |
| 515 | + | |
518 | 516 | | |
519 | 517 | | |
520 | 518 | | |
| |||
1454 | 1452 | | |
1455 | 1453 | | |
1456 | 1454 | | |
1457 | | - | |
| 1455 | + | |
1458 | 1456 | | |
1459 | 1457 | | |
1460 | 1458 | | |
| |||
4609 | 4607 | | |
4610 | 4608 | | |
4611 | 4609 | | |
4612 | | - | |
| 4610 | + | |
4613 | 4611 | | |
4614 | 4612 | | |
4615 | 4613 | | |
| |||
5465 | 5463 | | |
5466 | 5464 | | |
5467 | 5465 | | |
5468 | | - | |
| 5466 | + | |
5469 | 5467 | | |
5470 | 5468 | | |
5471 | 5469 | | |
| |||
6289 | 6287 | | |
6290 | 6288 | | |
6291 | 6289 | | |
| 6290 | + | |
6292 | 6291 | | |
6293 | 6292 | | |
6294 | 6293 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
763 | 763 | | |
764 | 764 | | |
765 | 765 | | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
766 | 772 | | |
767 | 773 | | |
768 | 774 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1929 | 1929 | | |
1930 | 1930 | | |
1931 | 1931 | | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
1932 | 1960 | | |
1933 | 1961 | | |
1934 | 1962 | | |
| |||
0 commit comments