[clang] [clang-format] Add an option to control indentation of `export { ... }` (PR #110381)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 8 01:38:16 PDT 2024
================
@@ -26588,10 +26613,7 @@ TEST_F(FormatTest, Cpp20ModulesSupport) {
" int foo;\n"
"};",
Style);
- verifyFormat("export {\n"
- " int foo;\n"
- "};",
- Style);
+ verifyFormat("export { int foo; };", Style);
----------------
Sirraide wrote:
Yeah, makes sense. As far as I understand it, were were previously just parsing this as a compound statement, which afaik isn’t formatted on a single line by default, but maybe namespaces are, but I’m candidly not quite sure what’s causing this to be formatted on one line... I think this has something to do with the fact that I used `parseBlock` for this, but I’ll have to look into it a bit more.
Do we want a separate option for this (e.g. something like `AllowShortExportBlocksOnASingleLine`) or should that just fall under `AllowShortBlocksOnASingleLine`?
https://github.com/llvm/llvm-project/pull/110381
More information about the cfe-commits
mailing list