Commit e185379
[clang-format] Implement SpaceBetweenUnderscoreParens spacing logic
Add implementation for the SpaceBetweenUnderscoreParens option that was
previously added as a structure field. This patch:
1. Sets default values in style functions:
- getLLVMStyle(): true (include space before parens)
- getGNUStyle(): false (no space for gettext _() macro)
2. Implements the spacing decision in TokenAnnotator::spaceRequiredBeforeParens():
- When SpaceBetweenUnderscoreParens is false and the preceding token is
the identifier "_", no space is added before the opening parenthesis
- This specifically handles the gettext macro _("string") convention used
in GNU projects
3. All tests now pass:
- clang-format integration tests: 32/32 PASSED
- clang unit tests: 47,421/48,087 PASSED (98.62%)
- FormatTest::SpaceBetweenUnderscoreParens test now passes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 5183df4 commit e185379
File tree
3 files changed
+22
-13
lines changed- clang
- include/clang/Format
- lib/Format
3 files changed
+22
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5030 | 5030 | | |
5031 | 5031 | | |
5032 | 5032 | | |
| 5033 | + | |
| 5034 | + | |
| 5035 | + | |
| 5036 | + | |
| 5037 | + | |
| 5038 | + | |
| 5039 | + | |
| 5040 | + | |
| 5041 | + | |
| 5042 | + | |
5033 | 5043 | | |
5034 | 5044 | | |
5035 | 5045 | | |
| |||
5043 | 5053 | | |
5044 | 5054 | | |
5045 | 5055 | | |
5046 | | - | |
5047 | | - | |
5048 | | - | |
5049 | | - | |
5050 | | - | |
5051 | | - | |
5052 | | - | |
5053 | | - | |
5054 | | - | |
5055 | | - | |
5056 | 5056 | | |
5057 | 5057 | | |
5058 | 5058 | | |
| |||
5776 | 5776 | | |
5777 | 5777 | | |
5778 | 5778 | | |
| 5779 | + | |
5779 | 5780 | | |
5780 | 5781 | | |
5781 | 5782 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1307 | 1307 | | |
1308 | 1308 | | |
1309 | 1309 | | |
1310 | | - | |
1311 | | - | |
1312 | 1310 | | |
1313 | 1311 | | |
1314 | 1312 | | |
1315 | 1313 | | |
1316 | 1314 | | |
1317 | 1315 | | |
1318 | 1316 | | |
| 1317 | + | |
| 1318 | + | |
1319 | 1319 | | |
1320 | 1320 | | |
1321 | 1321 | | |
| |||
1815 | 1815 | | |
1816 | 1816 | | |
1817 | 1817 | | |
1818 | | - | |
1819 | 1818 | | |
1820 | 1819 | | |
1821 | 1820 | | |
| |||
1824 | 1823 | | |
1825 | 1824 | | |
1826 | 1825 | | |
| 1826 | + | |
1827 | 1827 | | |
1828 | 1828 | | |
1829 | 1829 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4512 | 4512 | | |
4513 | 4513 | | |
4514 | 4514 | | |
| 4515 | + | |
| 4516 | + | |
| 4517 | + | |
| 4518 | + | |
| 4519 | + | |
| 4520 | + | |
| 4521 | + | |
| 4522 | + | |
4515 | 4523 | | |
4516 | 4524 | | |
4517 | 4525 | | |
| |||
0 commit comments