[clang] [clang] reject to capture variable in `RequiresExprBodyDecl` (PR #78598)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 19 21:48:30 PST 2024


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 e611a4cf8060bf0a95b4acd9e136733425da085a a99f16ff51702ff249cdf8a47de0cf24a08f694a -- clang/test/SemaCXX/requires-expression-with-capture-variable.cpp clang/test/SemaCXX/warn-unused-lambda-capture-cxx20.cpp clang/lib/Sema/SemaExpr.cpp clang/test/SemaCXX/warn-unused-lambda-capture.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 580e759f63..04cfe5435e 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -19721,7 +19721,8 @@ bool Sema::tryCaptureVariable(
   // it can therefore have non-negigible impact on performances.
   // For local variables and when there is no capturing scope,
   // we can bailout early.
-  if (CapturingFunctionScopes == 0 && (!BuildAndDiagnose || VarDC == CurContext))
+  if (CapturingFunctionScopes == 0 &&
+      (!BuildAndDiagnose || VarDC == CurContext))
     return true;
 
   DeclContext *DC = ignoreReuquiresBodyDecl(CurContext);

``````````

</details>


https://github.com/llvm/llvm-project/pull/78598


More information about the cfe-commits mailing list