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 HEAD~1 HEAD --extensions cpp,h -- 
clang/test/FixIt/fixit-unused-lambda-capture-trailing-tokens.cpp 
clang/include/clang/Sema/Sema.h clang/lib/Sema/Sema.cpp 
clang/lib/Sema/SemaLambda.cpp clang/test/FixIt/fixit-unused-lambda-capture.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 636bbdfa9..84d30561f 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -975,10 +975,9 @@ public:
   /// Calls \c Lexer::findNextToken() to find the next token, and if the
   /// locations of both ends of the token can be resolved it return that
   /// range; Otherwise it returns an invalid SourceRange.
-  SourceRange getRangeForNextToken(SourceLocation Loc,
-                                   bool IncludeMacros,
-                                   bool IncludeComments,
-                                   std::optional<tok::TokenKind> ExpectedToken 
= std::nullopt);
+  SourceRange getRangeForNextToken(
+      SourceLocation Loc, bool IncludeMacros, bool IncludeComments,
+      std::optional<tok::TokenKind> ExpectedToken = std::nullopt);
 
   /// Retrieve the module loader associated with the preprocessor.
   ModuleLoader &getModuleLoader() const;
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index b1ccff806..051844e3d 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -84,10 +84,10 @@ SourceLocation Sema::getLocForEndOfToken(SourceLocation 
Loc, unsigned Offset) {
   return Lexer::getLocForEndOfToken(Loc, Offset, SourceMgr, LangOpts);
 }
 
-SourceRange Sema::getRangeForNextToken(SourceLocation Loc,
-                                       bool IncludeMacros,
-                                       bool IncludeComments,
-                                       std::optional<tok::TokenKind> 
ExpectedToken) {
+SourceRange
+Sema::getRangeForNextToken(SourceLocation Loc, bool IncludeMacros,
+                           bool IncludeComments,
+                           std::optional<tok::TokenKind> ExpectedToken) {
   if (!Loc.isValid())
     return SourceRange();
   std::optional<Token> NextToken =
diff --git a/clang/lib/Sema/SemaLambda.cpp b/clang/lib/Sema/SemaLambda.cpp
index c6a7d0f32..eecb1a3ee 100644
--- a/clang/lib/Sema/SemaLambda.cpp
+++ b/clang/lib/Sema/SemaLambda.cpp
@@ -2172,7 +2172,8 @@ ExprResult Sema::BuildLambdaExpr(SourceLocation StartLoc, 
SourceLocation EndLoc,
           if (CaptureRange.isValid()) {
             auto GetTrailingEndLocation = [&](SourceLocation StartPoint) {
               SourceRange NextToken =
-                  getRangeForNextToken(StartPoint, /*IncludeMacros=*/false, 
/*IncludeComments=*/true);
+                  getRangeForNextToken(StartPoint, /*IncludeMacros=*/false,
+                                       /*IncludeComments=*/true);
               if (!NextToken.isValid())
                 return SourceLocation();
               // Return the last location preceding the next token
@@ -2181,8 +2182,9 @@ ExprResult Sema::BuildLambdaExpr(SourceLocation StartLoc, 
SourceLocation EndLoc,
             if (!CurHasPreviousCapture && !IsLast) {
               // If there are no captures preceding this capture, remove the
               // trailing comma and anything up to the next token
-              SourceRange CommaRange =
-                  getRangeForNextToken(CaptureRange.getEnd(), 
/*IncludeMacros=*/false, /*IncludeComments=*/false, tok::comma);
+              SourceRange CommaRange = getRangeForNextToken(
+                  CaptureRange.getEnd(), /*IncludeMacros=*/false,
+                  /*IncludeComments=*/false, tok::comma);
               SourceLocation FixItEnd =
                   GetTrailingEndLocation(CommaRange.getBegin());
               FixItRange = SourceRange(CaptureRange.getBegin(), FixItEnd);
@@ -2196,7 +2198,8 @@ ExprResult Sema::BuildLambdaExpr(SourceLocation StartLoc, 
SourceLocation EndLoc,
             }
           }
 
-          IsCaptureUsed = !DiagnoseUnusedLambdaCapture(CaptureRange, 
FixItRange, From);
+          IsCaptureUsed =
+              !DiagnoseUnusedLambdaCapture(CaptureRange, FixItRange, From);
         }
       }
 

``````````

</details>


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

Reply via email to