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 42b160356fe5d3b41bf07c428d0142d3721b1d44 490343ec3461a8a3a5703198f6b9af57a853ef24 -- clang/lib/Format/Format.cpp clang/unittests/Format/SortIncludesTest.cpp `````````` </details> <details> <summary> View the diff from clang-format here. </summary> ``````````diff diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 81ec3b245e..ca828c0653 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -3140,7 +3140,7 @@ static void sortCppIncludes(const FormatStyle &Style, // If the #includes are out of order, we generate a single replacement fixing // the entire range of blocks. Otherwise, no replacement is generated. if (replaceCRLF(result) == replaceCRLF(std::string(Code.substr( - IncludesBeginOffset, IncludesBlockSize)))) { + IncludesBeginOffset, IncludesBlockSize)))) { return; } diff --git a/clang/unittests/Format/SortIncludesTest.cpp b/clang/unittests/Format/SortIncludesTest.cpp index e73770a21e..e5e91837bf 100644 --- a/clang/unittests/Format/SortIncludesTest.cpp +++ b/clang/unittests/Format/SortIncludesTest.cpp @@ -821,22 +821,19 @@ TEST_F(SortIncludesTest, CalculatesCorrectCursorPositionWithRegrouping) { EXPECT_EQ(27u, newCursor(Code, 28)); // Start of last line } -TEST_F(SortIncludesTest, CalculatesCorrectCursorPositionWhenNoReplacementsWithRegroupingAndCRLF) -{ - Style.IncludeBlocks = Style.IBS_Regroup; - FmtStyle.LineEnding = FormatStyle::LE_CRLF; +TEST_F(SortIncludesTest, + CalculatesCorrectCursorPositionWhenNoReplacementsWithRegroupingAndCRLF) { + Style.IncludeBlocks = Style.IBS_Regroup; + FmtStyle.LineEnding = FormatStyle::LE_CRLF; Style.IncludeCategories = { - {"^\"a\"", 0, 0, false}, - {"^\"b\"", 1, 1, false}, - {".*", 2, 2, false}}; - std::string Code = - "#include \"a\"\r\n" // Start of line: 0 - "\r\n" // Start of line: 14 - "#include \"b\"\r\n" // Start of line: 16 - "\r\n" // Start of line: 30 - "#include \"c\"\r\n" // Start of line: 32 - "\r\n" // Start of line: 46 - "int i;"; // Start of line: 48 + {"^\"a\"", 0, 0, false}, {"^\"b\"", 1, 1, false}, {".*", 2, 2, false}}; + std::string Code = "#include \"a\"\r\n" // Start of line: 0 + "\r\n" // Start of line: 14 + "#include \"b\"\r\n" // Start of line: 16 + "\r\n" // Start of line: 30 + "#include \"c\"\r\n" // Start of line: 32 + "\r\n" // Start of line: 46 + "int i;"; // Start of line: 48 verifyNoChange(Code); EXPECT_EQ(0u, newCursor(Code, 0)); EXPECT_EQ(14u, newCursor(Code, 14)); `````````` </details> https://github.com/llvm/llvm-project/pull/77456 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits