[llvm-branch-commits] [clang] [clang] Introduce scopes for arguments without destructors (PR #191019)
Paul Kirth via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Apr 8 15:49:18 PDT 2026
================
@@ -6861,6 +6861,27 @@ LValue CodeGenFunction::EmitStmtExprLValue(const StmtExpr *E) {
AlignmentSource::Decl);
}
+// Check if it is safe to tighten the lifetime of temporary aggregates for this
+// call. We can only do this if the call does not involve destructors or
+// Objective-C retainable types, as those push cleanups that must outlive the
+// call.
+static bool isSafeToTightenLifetime(const CallExpr *E) {
+ QualType RetTy = E->getType().getCanonicalType();
+ if (RetTy->isObjCRetainableType())
+ return false;
+
+ for (const auto *Arg : E->arguments()) {
+ if (Arg->getType().isDestructedType())
+ return false;
+
+ QualType Ty = Arg->getType().getNonReferenceType().getCanonicalType();
+ if (Ty->isObjCRetainableType())
----------------
ilovepi wrote:
I did hit some issues in testing with this when I didn't have this bit. Let me look again though.
https://github.com/llvm/llvm-project/pull/191019
More information about the llvm-branch-commits
mailing list