================ @@ -1284,16 +1294,26 @@ void checkExprLifetime(Sema &SemaRef, const InitializedEntity &Entity, auto LTResult = getEntityLifetime(&Entity); LifetimeKind LK = LTResult.getInt(); const InitializedEntity *ExtendingEntity = LTResult.getPointer(); - checkExprLifetimeImpl(SemaRef, &Entity, ExtendingEntity, LK, nullptr, Init); + bool EnableLifetimeWarnings = !SemaRef.getDiagnostics().isIgnored( + diag::warn_dangling_lifetime_pointer, SourceLocation()); + checkExprLifetimeImpl(SemaRef, &Entity, ExtendingEntity, LK, nullptr, Init, ---------------- hokein wrote:
We still need to run the code (not the gsl-specific part) even if we disable all dangling diagnostics. Because this code has the functionality that performs the lifetime extension when needed (see https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/CheckExprLifetime.cpp#L1043-L1045). https://github.com/llvm/llvm-project/pull/99032 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits