[llvm-branch-commits] [clang] [clang] Introduce scopes for arguments without destructors (PR #191019)
Eli Friedman via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Apr 8 15:10:27 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())
----------------
efriedma-quic wrote:
I think isDestructedType() should be true for the relevant ObjC types?
https://github.com/llvm/llvm-project/pull/191019
More information about the llvm-branch-commits
mailing list