llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-format

Author: Eugene Shalygin (zeule)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/189218.diff


2 Files Affected:

- (modified) clang/lib/Format/ContinuationIndenter.cpp (+12) 
- (modified) clang/unittests/Format/FormatTest.cpp (+12) 


``````````diff
diff --git a/clang/lib/Format/ContinuationIndenter.cpp 
b/clang/lib/Format/ContinuationIndenter.cpp
index a388b74920e0b..8201706275776 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -1237,6 +1237,18 @@ unsigned 
ContinuationIndenter::addTokenOnNewLine(LineState &State,
           Style.ContinuationIndentWidth;
     }
   }
+  if (Style.BreakInheritanceList == FormatStyle::BILS_AfterComma) {
+    if (Previous.isOneOf(TT_InheritanceComma, tok::comma) &&
+        Current.isOneOf(tok::kw_private, tok::kw_protected, tok::kw_public)) {
+      CurrentState.IsAligned = true;
+    }
+  }
+  if (Style.BreakInheritanceList == FormatStyle::BILS_BeforeColon) {
+    if (Previous.isOneOf(TT_InheritanceComma, tok::comma) &&
+        Current.isOneOf(tok::kw_private, tok::kw_protected, tok::kw_public)) {
+      CurrentState.IsAligned = true;
+    }
+  }
 
   if ((PreviousNonComment &&
        PreviousNonComment->isOneOf(tok::comma, tok::semi) &&
diff --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index 3d55a814e6027..bf087387b1d2b 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -8433,6 +8433,18 @@ TEST_F(FormatTest, 
BreakConstructorInitializersAfterColon) {
       "  : public aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n"
       "    public bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb {};",
       Style);
+  FormatStyle Tab = getLLVMStyleWithColumns(42);
+  Tab.IndentWidth = 4;
+  Tab.TabWidth = 4;
+  Tab.UseTab = FormatStyle::UT_AlignWithSpaces;
+  verifyFormat("class Foo : public aaaaaaaaa,\n"
+               "            public bbbbbbbbb\n",
+               Tab);
+  verifyFormat("struct S {\n"
+               "\tclass Foo : public aaaaaaaaa,\n"
+               "\t            public bbbbbbbbb {};\n"
+               "};",
+               Tab);
 }
 
 TEST_F(FormatTest, BreakConstructorInitializersAfterComma) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/189218
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to