================ @@ -1553,6 +1563,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) { LLVMStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_All; LLVMStyle.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never; LLVMStyle.AllowShortLambdasOnASingleLine = FormatStyle::SLS_All; + LLVMStyle.AllowShortRecordOnASingleLine = FormatStyle::SRS_Never; ---------------- itzexpoexpo wrote:
I'll try to clarify: ```c++ // a.cpp class foo {}; // Omitting the contentful class to keep the comment shorter ``` Config (when `-style=file` specified, referring to default style otherwise): ```yaml BasedOnStyle: LLVM BreakBeforeBraces: Custom BraceWrapping: AfterClass: true SplitEmptyRecord: false ``` Before patch: ```c++ $ clang-format a.cpp class foo {}; $ clang-format a.cpp -style=file:.clang_format class foo {}; ``` With patch as of latest commit: ```c++ $ clang-format a.cpp class foo {}; $ clang-format a.cpp -style=file:.clang_format class foo {}; ``` i.e. feature is entirely opt-in for users, no breaking changes. Suggested change to make `Never` (default as of latest commit) explicitly disallow merging short records, instead of being treated more like "ignore this option": ```c++ $ clang-format a.cpp class foo { }; $ clang-format a.cpp -style=file:.clang-format class foo {}; ``` (This should be the correct behavior, also same as if #154796 went through) Suggested change to make `Empty` the default instead: ```c++ $ clang-format a.cpp class foo {}; $ clang-format a.cpp -style=file:.clang_format class foo {}; ``` Both suggested changes mean that existing code will be formatted differently, I'd like to confirm whether that's okay and you'd like to go through with one or both of the changes? An alternative I can offer would be to introduce a separate `Ignore` option for `AllowShortRecordOnASingleLine` and make that the default, since no other options use such a value I didn't either, but it would allow implementing `Never` correctly. https://github.com/llvm/llvm-project/pull/154580 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits