Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,7 @@ clang-format
------------
- Add ``AllowBreakBeforeNoexceptSpecifier`` option.
- Add ``AllowShortCompoundRequirementOnASingleLine`` option.
- Change ``BreakAfterAttributes`` from ``Never`` to ``Leave`` in LLVM style

libclang
--------
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Format/Format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1476,7 +1476,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) {
/*SplitEmptyFunction=*/true,
/*SplitEmptyRecord=*/true,
/*SplitEmptyNamespace=*/true};
LLVMStyle.BreakAfterAttributes = FormatStyle::ABS_Never;
LLVMStyle.BreakAfterAttributes = FormatStyle::ABS_Leave;
LLVMStyle.BreakAfterJavaFieldAnnotations = false;
LLVMStyle.BreakArrays = true;
LLVMStyle.BreakBeforeBinaryOperators = FormatStyle::BOS_None;
Expand Down
7 changes: 3 additions & 4 deletions clang/unittests/Format/FormatTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26179,7 +26179,7 @@ TEST_F(FormatTest, RemoveSemicolon) {

TEST_F(FormatTest, BreakAfterAttributes) {
FormatStyle Style = getLLVMStyle();
EXPECT_EQ(Style.BreakAfterAttributes, FormatStyle::ABS_Never);
EXPECT_EQ(Style.BreakAfterAttributes, FormatStyle::ABS_Leave);

constexpr StringRef Code("[[nodiscard]] inline int f(int &i);\n"
"[[foo([[]])]] [[nodiscard]]\n"
Expand All @@ -26193,7 +26193,9 @@ TEST_F(FormatTest, BreakAfterAttributes) {
" i = 0;\n"
" return 1;\n"
"}");
verifyNoChange(Code, Style);

Style.BreakAfterAttributes = FormatStyle::ABS_Never;
verifyFormat("[[nodiscard]] inline int f(int &i);\n"
"[[foo([[]])]] [[nodiscard]] int g(int &i);\n"
"[[nodiscard]] inline int f(int &i) {\n"
Expand All @@ -26206,9 +26208,6 @@ TEST_F(FormatTest, BreakAfterAttributes) {
"}",
Code, Style);

Style.BreakAfterAttributes = FormatStyle::ABS_Leave;
verifyNoChange(Code, Style);

Style.BreakAfterAttributes = FormatStyle::ABS_Always;
verifyFormat("[[nodiscard]]\n"
"inline int f(int &i);\n"
Expand Down