github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h --
clang/include/clang/Format/Format.h clang/lib/Format/ContinuationIndenter.cpp
clang/lib/Format/Format.cpp clang/unittests/Format/ConfigParseTest.cpp
clang/unittests/Format/FormatTest.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Format/ContinuationIndenter.cpp
b/clang/lib/Format/ContinuationIndenter.cpp
index b50e4fa44..0cd60c789 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -1111,7 +1111,7 @@ void
ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun,
} else if (Previous.is(TT_InheritanceColon)) {
// Indent relative to the inheritance colon if the inheritance list
// is being broken into separate lines.
- if(Style.BreakInheritanceList != FormatStyle::BILS_No) {
+ if (Style.BreakInheritanceList != FormatStyle::BILS_No) {
CurrentState.Indent = State.Column;
CurrentState.LastSpace = State.Column;
}
@@ -1865,9 +1865,10 @@ unsigned
ContinuationIndenter::moveStateToNextToken(LineState &State,
else
CurrentState.BreakBeforeParameter = false;
}
- if (Current.is(TT_InheritanceColon) && Style.BreakInheritanceList !=
FormatStyle::BILS_No) {
- CurrentState.Indent =
- State.FirstIndent + Style.ConstructorInitializerIndentWidth;
+ if (Current.is(TT_InheritanceColon) &&
+ Style.BreakInheritanceList != FormatStyle::BILS_No) {
+ CurrentState.Indent =
+ State.FirstIndent + Style.ConstructorInitializerIndentWidth;
}
if (Current.isOneOf(TT_BinaryOperator, TT_ConditionalExpr) && Newline)
CurrentState.NestedBlockIndent = State.Column + Current.ColumnWidth + 1;
diff --git a/clang/unittests/Format/FormatTest.cpp
b/clang/unittests/Format/FormatTest.cpp
index ba7c0e3db..529c9dd27 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -3816,15 +3816,14 @@ TEST_F(FormatTest, FormatsClasses) {
TEST_F(FormatTest, BreakInheritanceStyle) {
FormatStyle StyleWithInheritanceBreakNo = getLLVMStyle();
- StyleWithInheritanceBreakNo.BreakInheritanceList =
- FormatStyle::BILS_No;
- verifyFormat("class MyClass : public X {};",
- StyleWithInheritanceBreakNo);
+ StyleWithInheritanceBreakNo.BreakInheritanceList = FormatStyle::BILS_No;
+ verifyFormat("class MyClass : public X {};", StyleWithInheritanceBreakNo);
verifyFormat("class MyClass : public X, public Y {};",
StyleWithInheritanceBreakNo);
- verifyFormat("class AAAAAAAAAAAAAAAAAAAAAA : public
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,\n"
- " public CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC {};",
- StyleWithInheritanceBreakNo);
+ verifyFormat(
+ "class AAAAAAAAAAAAAAAAAAAAAA : public BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,\n"
+ " public CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC {};",
+ StyleWithInheritanceBreakNo);
verifyFormat("class MyOuterClass {\n"
" class MyClass : public BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,\n"
" public CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC {};",
``````````
</details>
https://github.com/llvm/llvm-project/pull/196832
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits