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 2847020dbd9b8f932ee564651ec72ce15fa37d07 
84ba9930e4650319265b2fabd2715268a91de614 --extensions cpp,h -- 
clang/include/clang/Format/Format.h clang/lib/Format/Format.cpp 
clang/lib/Format/UnwrappedLineFormatter.cpp 
clang/unittests/Format/FormatTest.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp 
b/clang/lib/Format/UnwrappedLineFormatter.cpp
index f3f76ac227..4d39c7eaf2 100644
--- a/clang/lib/Format/UnwrappedLineFormatter.cpp
+++ b/clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -32,21 +32,21 @@ bool isRecordLBrace(const FormatToken &Tok) {
                      TT_StructLBrace, TT_UnionLBrace);
 }
 
-bool LineStartsNamespaceScope(const AnnotatedLine* Line,
-                              const AnnotatedLine* PreviousLine,
-                              const AnnotatedLine* PrevPrevLine) {
+bool LineStartsNamespaceScope(const AnnotatedLine *Line,
+                              const AnnotatedLine *PreviousLine,
+                              const AnnotatedLine *PrevPrevLine) {
   return PreviousLine && PreviousLine->Last->is(tok::l_brace) &&
          (PreviousLine->startsWithNamespace() ||
           (PrevPrevLine && PrevPrevLine->startsWithNamespace() &&
-           PreviousLine->startsWith(tok::l_brace))) && 
!Line->startsWithNamespace();
+           PreviousLine->startsWith(tok::l_brace))) &&
+         !Line->startsWithNamespace();
 }
 
 bool LineEndsNamespaceScope(const AnnotatedLine *Line,
-                            const SmallVectorImpl<AnnotatedLine*> &Lines) {
-  const FormatToken* tok = Line->First;
-  if (!tok || tok->isNot(tok::r_brace)) {
+                            const SmallVectorImpl<AnnotatedLine *> &Lines) {
+  const FormatToken *tok = Line->First;
+  if (!tok || tok->isNot(tok::r_brace))
     return false;
-  }
   return getNamespaceToken(Line, Lines) != nullptr;
 }
 
@@ -1519,7 +1519,8 @@ static auto computeNewlines(const AnnotatedLine &Line,
 
   // Insert empty line before "}" that closes namespace scope
   if (Style.WrapNamespaceBodyWithNewlines &&
-      LineEndsNamespaceScope(&Line, Lines) && 
!LineEndsNamespaceScope(PreviousLine, Lines)) {
+      LineEndsNamespaceScope(&Line, Lines) &&
+      !LineEndsNamespaceScope(PreviousLine, Lines)) {
     Newlines = std::max(Newlines, 2u);
   }
 
diff --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index 94d8d652f8..362ac3af6f 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -28096,7 +28096,8 @@ TEST_F(FormatTest, WrappingNamespaceBodyWithNewlines) {
   // Single namespace
   verifyFormat("namespace N {\n\n"
                "int f1(int a) { return 2 * a; }\n\n"
-               "};", Style);
+               "};",
+               Style);
 
   // Nested namespace
   verifyFormat("namespace N1 {\n"
@@ -28108,7 +28109,8 @@ TEST_F(FormatTest, WrappingNamespaceBodyWithNewlines) {
                "}\n\n"
                "}\n"
                "}\n"
-               "}", Style);
+               "}",
+               Style);
 
   Style.WrapNamespaceBodyWithNewlines = false;
 
@@ -28118,7 +28120,8 @@ TEST_F(FormatTest, WrappingNamespaceBodyWithNewlines) {
   // Single namespace
   verifyFormat("namespace N {\n"
                "int f1(int a) { return 2 * a; }\n"
-               "};", Style);
+               "};",
+               Style);
 
   // Nested namespace
   verifyFormat("namespace N1 {\n"
@@ -28130,7 +28133,8 @@ TEST_F(FormatTest, WrappingNamespaceBodyWithNewlines) {
                "}\n"
                "}\n"
                "}\n"
-               "}", Style);
+               "}",
+               Style);
 }
 
 TEST_F(FormatTest, WrappingNamespaceBodyWithNewlinesWithCompactNamespaces) {
@@ -28139,13 +28143,13 @@ TEST_F(FormatTest, 
WrappingNamespaceBodyWithNewlinesWithCompactNamespaces) {
   Style.CompactNamespaces = true;
   Style.WrapNamespaceBodyWithNewlines = true;
 
-
   verifyFormat("namespace N1 { namespace N2 { namespace N3 {\n\n"
                "int f1() {\n"
                "  int a = 1;\n"
                "  return a;\n"
                "}\n\n"
-               "}}}", Style);
+               "}}}",
+               Style);
 
   Style.WrapNamespaceBodyWithNewlines = false;
 
@@ -28154,7 +28158,8 @@ TEST_F(FormatTest, 
WrappingNamespaceBodyWithNewlinesWithCompactNamespaces) {
                "  int a = 1;\n"
                "  return a;\n"
                "}\n"
-               "}}}", Style);
+               "}}}",
+               Style);
 }
 
 } // namespace

``````````

</details>


https://github.com/llvm/llvm-project/pull/106145
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to