Commit b205064
[clang-format] Handle Trailing Whitespace After Line Continuation (P2223R2) (llvm#145243)
Fixes llvm#145226.
Implement
[P2223R2](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2223r2.pdf)
in clang-format to correctly handle cases where a backslash '\\' is
followed by trailing whitespace before the newline.
Previously, `clang-format` failed to properly detect and handle such
cases, leading to misformatted code.
With this, `clang-format` matches the behavior already implemented in
Clang's lexer and `DependencyDirectivesScanner.cpp`, which allow
trailing whitespace after a line continuation in any C++ standard.1 parent ff33f69 commit b205064
File tree
2 files changed
+36
-9
lines changed- clang
- lib/Format
- unittests/Format
2 files changed
+36
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
1203 | 1204 | | |
1204 | 1205 | | |
1205 | 1206 | | |
1206 | | - | |
| 1207 | + | |
1207 | 1208 | | |
1208 | | - | |
1209 | | - | |
1210 | | - | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
1211 | 1212 | | |
1212 | 1213 | | |
1213 | 1214 | | |
1214 | | - | |
1215 | | - | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
1216 | 1223 | | |
1217 | 1224 | | |
1218 | 1225 | | |
| |||
1295 | 1302 | | |
1296 | 1303 | | |
1297 | 1304 | | |
1298 | | - | |
1299 | | - | |
| 1305 | + | |
1300 | 1306 | | |
1301 | 1307 | | |
1302 | 1308 | | |
1303 | 1309 | | |
1304 | | - | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
1305 | 1317 | | |
1306 | 1318 | | |
1307 | 1319 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25768 | 25768 | | |
25769 | 25769 | | |
25770 | 25770 | | |
| 25771 | + | |
| 25772 | + | |
| 25773 | + | |
| 25774 | + | |
| 25775 | + | |
| 25776 | + | |
| 25777 | + | |
| 25778 | + | |
| 25779 | + | |
| 25780 | + | |
| 25781 | + | |
| 25782 | + | |
| 25783 | + | |
| 25784 | + | |
| 25785 | + | |
25771 | 25786 | | |
25772 | 25787 | | |
25773 | 25788 | | |
| |||
0 commit comments