[clang] [llvm] [clang] Implement lifetime analysis for lifetime_capture_by(X) (PR #115921)
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 20 04:24:29 PST 2024
================
@@ -1460,7 +1486,18 @@ void checkExprLifetime(Sema &SemaRef, const AssignedEntity &Entity,
checkExprLifetimeImpl(SemaRef, /*InitEntity=*/nullptr,
/*ExtendingEntity=*/nullptr, LK_Assignment, &Entity,
- Init);
+ /*CapEntity=*/nullptr, Init);
+}
+
+void checkCaptureByLifetime(Sema &SemaRef, const CapturingEntity &Entity,
+ Expr *Init) {
+ if (!SemaRef.getDiagnostics().isIgnored(
+ diag::warn_dangling_reference_captured, SourceLocation()))
----------------
hokein wrote:
we should do it for `warn_dangling_reference_captured_by_unknown` as well?
https://github.com/llvm/llvm-project/pull/115921
More information about the cfe-commits
mailing list