[clang] [clang] Introduce [[clang::lifetime_capture_by(X)]] (PR #111499)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 13 04:00:17 PST 2024


================
@@ -1091,21 +1104,22 @@ static bool isAssignmentOperatorLifetimeBound(CXXMethodDecl *CMD) {
 }
 
 static bool shouldRunGSLAssignmentAnalysis(const Sema &SemaRef,
-                                           const AssignedEntity &Entity) {
+                                           const CapturingEntity &Entity) {
   bool EnableGSLAssignmentWarnings = !SemaRef.getDiagnostics().isIgnored(
       diag::warn_dangling_lifetime_pointer_assignment, SourceLocation());
   return (EnableGSLAssignmentWarnings &&
-          (isRecordWithAttr<PointerAttr>(Entity.LHS->getType()) ||
+          (isRecordWithAttr<PointerAttr>(Entity.Expression->getType()) ||
            isAssignmentOperatorLifetimeBound(Entity.AssignmentOperator)));
 }
 
 static void checkExprLifetimeImpl(Sema &SemaRef,
                                   const InitializedEntity *InitEntity,
                                   const InitializedEntity *ExtendingEntity,
                                   LifetimeKind LK,
-                                  const AssignedEntity *AEntity, Expr *Init) {
-  assert((AEntity && LK == LK_Assignment) ||
-         (InitEntity && LK != LK_Assignment));
+                                  const CapturingEntity *CEntity, Expr *Init) {
----------------
usx95 wrote:

Done in https://github.com/llvm/llvm-project/pull/115921

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


More information about the cfe-commits mailing list