[clang] [clang] Implement lifetime analysis for lifetime_capture_by(X) (PR #115921)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 12 10:27:03 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 f9125ddc1faafaceac9064e889cd9b4a77523677 4f6e2bf7ae5356e226442755bb88833b01a9d683 --extensions cpp,h -- clang/test/AST/attr-lifetime-capture-by.cpp clang/test/SemaCXX/attr-lifetime-capture-by.cpp clang/include/clang/Sema/Sema.h clang/lib/AST/TypePrinter.cpp clang/lib/Sema/CheckExprLifetime.cpp clang/lib/Sema/CheckExprLifetime.h clang/lib/Sema/SemaChecking.cpp clang/lib/Sema/SemaDecl.cpp clang/lib/Sema/SemaDeclAttr.cpp clang/lib/Sema/SemaType.cpp clang/test/Sema/warn-lifetime-analysis-nocfg.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Sema/CheckExprLifetime.cpp b/clang/lib/Sema/CheckExprLifetime.cpp
index 57c70fc357..89d088c98e 100644
--- a/clang/lib/Sema/CheckExprLifetime.cpp
+++ b/clang/lib/Sema/CheckExprLifetime.cpp
@@ -1120,13 +1120,11 @@ static bool shouldRunGSLAssignmentAnalysis(const Sema &SemaRef,
isAssignmentOperatorLifetimeBound(Entity.AssignmentOperator)));
}
-static void checkExprLifetimeImpl(Sema &SemaRef,
- const InitializedEntity *InitEntity,
- const InitializedEntity *ExtendingEntity,
- LifetimeKind LK,
- const AssignedEntity *AEntity,
- const CapturingEntity* CapEntity,
- Expr *Init) {
+static void
+checkExprLifetimeImpl(Sema &SemaRef, const InitializedEntity *InitEntity,
+ const InitializedEntity *ExtendingEntity, LifetimeKind LK,
+ const AssignedEntity *AEntity,
+ const CapturingEntity *CapEntity, Expr *Init) {
assert((AEntity && LK == LK_Assignment) ||
(CapEntity && LK == LK_LifetimeCapture) ||
(InitEntity && LK != LK_Assignment));
``````````
</details>
https://github.com/llvm/llvm-project/pull/115921
More information about the cfe-commits
mailing list