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 h,cpp -- 
clang/include/clang/Tooling/Inclusions/IncludeStyle.h 
clang/lib/Format/Format.cpp clang/lib/Tooling/Inclusions/IncludeStyle.cpp 
clang/unittests/Format/ConfigParseTest.cpp 
clang/unittests/Format/SortIncludesTest.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/Format.cpp b/clang/lib/Format/Format.cpp
index c4fd8d824..4cd8d2747 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -1967,10 +1967,10 @@ FormatStyle getGoogleStyle(FormatStyle::LanguageKind 
Language) {
   GoogleStyle.BreakTemplateDeclarations = FormatStyle::BTDS_Yes;
   GoogleStyle.IncludeStyle.IncludeBlocks = tooling::IncludeStyle::IBS_Regroup;
   GoogleStyle.IncludeStyle.IncludeCategories = {
-    {"^<ext/.*\\.h>", 2, 0, false, 1},
-    {"^<.*\\.h>", 1, 0, false, 1},
-    {"^<.*", 2, 0, false, 1},
-    {".*", 3, 0, false, 1}};
+      {"^<ext/.*\\.h>", 2, 0, false, 1},
+      {"^<.*\\.h>", 1, 0, false, 1},
+      {"^<.*", 2, 0, false, 1},
+      {".*", 3, 0, false, 1}};
   GoogleStyle.IncludeStyle.IncludeIsMainRegex = "([-_](test|unittest))?$";
   GoogleStyle.IndentCaseLabels = true;
   GoogleStyle.KeepEmptyLines.AtStartOfBlock = false;
@@ -3537,19 +3537,16 @@ static void sortCppIncludes(const FormatStyle &Style,
                 Indices.end());
 
   const auto GetEmptyLines = [&](int LastCategory, int NewCategory) -> int {
-    if (LastCategory == NewCategory) {
+    if (LastCategory == NewCategory)
       return 0;
-    }
     const int LowerBound = std::min(LastCategory, NewCategory);
     const int UpperBound = std::max(LastCategory, NewCategory);
     int EmptyLines = 1;
     for (const auto &IncludeCategory : Style.IncludeStyle.IncludeCategories) {
-      if (IncludeCategory.Priority <= LowerBound) {
+      if (IncludeCategory.Priority <= LowerBound)
         continue;
-      }
-      if (IncludeCategory.Priority > UpperBound) {
+      if (IncludeCategory.Priority > UpperBound)
         break;
-      }
       EmptyLines = std::max(EmptyLines, IncludeCategory.EmptyLines);
     }
     return EmptyLines;
@@ -3578,9 +3575,8 @@ static void sortCppIncludes(const FormatStyle &Style,
               tooling::IncludeStyle::IBS_Regroup &&
           CurrentCategory != NewCategory) {
         const int EmptyLineCount = GetEmptyLines(CurrentCategory, NewCategory);
-        for (int Count = 0; Count < EmptyLineCount; ++Count) {
+        for (int Count = 0; Count < EmptyLineCount; ++Count)
           result += "\n";
-        }
       }
     }
     result += Includes[Index].Text;
diff --git a/clang/unittests/Format/SortIncludesTest.cpp 
b/clang/unittests/Format/SortIncludesTest.cpp
index 0b0408e17..4fbda75fb 100644
--- a/clang/unittests/Format/SortIncludesTest.cpp
+++ b/clang/unittests/Format/SortIncludesTest.cpp
@@ -685,8 +685,9 @@ TEST_F(SortIncludesTest, 
SupportOptionalCaseSensitiveSorting) {
                     "a.h"));
 
   Style.IncludeBlocks = tooling::IncludeStyle::IBS_Regroup;
-  Style.IncludeCategories = {
-      {"^\"", 1, 0, false, 1}, {"^<.*\\.h>$", 2, 0, false}, {"^<", 3, 0, 
false, 1}};
+  Style.IncludeCategories = {{"^\"", 1, 0, false, 1},
+                             {"^<.*\\.h>$", 2, 0, false},
+                             {"^<", 3, 0, false, 1}};
 
   StringRef UnsortedCode = "#include \"qt.h\"\n"
                            "#include <algorithm>\n"
@@ -865,8 +866,9 @@ TEST_F(SortIncludesTest,
        CalculatesCorrectCursorPositionWhenNoReplacementsWithRegroupingAndCRLF) 
{
   Style.IncludeBlocks = Style.IBS_Regroup;
   FmtStyle.LineEnding = FormatStyle::LE_CRLF;
-  Style.IncludeCategories = {
-      {"^\"a\"", 0, 0, false, 1}, {"^\"b\"", 1, 1, false}, {".*", 2, 2, false, 
1}};
+  Style.IncludeCategories = {{"^\"a\"", 0, 0, false, 1},
+                             {"^\"b\"", 1, 1, false},
+                             {".*", 2, 2, false, 1}};
   StringRef Code = "#include \"a\"\r\n" // Start of line: 0
                    "\r\n"               // Start of line: 14
                    "#include \"b\"\r\n" // Start of line: 16
@@ -1198,8 +1200,9 @@ TEST_F(SortIncludesTest, 
MainIncludeCharAnyPickAngleBracket) {
 }
 
 TEST_F(SortIncludesTest, MainIncludeCharQuoteAndRegroup) {
-  Style.IncludeCategories = {
-      {"lib-a", 1, 0, false, 1}, {"lib-b", 2, 0, false}, {"lib-c", 3, 0, 
false, 1}};
+  Style.IncludeCategories = {{"lib-a", 1, 0, false, 1},
+                             {"lib-b", 2, 0, false},
+                             {"lib-c", 3, 0, false, 1}};
   Style.IncludeBlocks = tooling::IncludeStyle::IBS_Regroup;
   Style.MainIncludeChar = tooling::IncludeStyle::MICD_Quote;
 
@@ -1228,8 +1231,9 @@ TEST_F(SortIncludesTest, MainIncludeCharQuoteAndRegroup) {
 }
 
 TEST_F(SortIncludesTest, MainIncludeCharAngleBracketAndRegroup) {
-  Style.IncludeCategories = {
-      {"lib-a", 1, 0, false, 1}, {"lib-b", 2, 0, false}, {"lib-c", 3, 0, 
false, 1}};
+  Style.IncludeCategories = {{"lib-a", 1, 0, false, 1},
+                             {"lib-b", 2, 0, false},
+                             {"lib-c", 3, 0, false, 1}};
   Style.IncludeBlocks = tooling::IncludeStyle::IBS_Regroup;
   Style.MainIncludeChar = tooling::IncludeStyle::MICD_AngleBracket;
 

``````````

</details>


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

Reply via email to