[llvm-branch-commits] [clang] [clang] Use uniform lifetime bounds under exceptions (PR #175817)

Eli Friedman via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jan 14 12:58:22 PST 2026


================
@@ -2647,6 +2647,10 @@ ExprResult Sema::BuildCXXNew(SourceRange Range, bool UseGlobal,
         CCE->getConstructor()->getParent());
   }
 
+  if (OperatorDelete && !OperatorDelete->isReservedGlobalPlacementOperator() &&
+      Initializer && canThrow(Initializer))
----------------
efriedma-quic wrote:

I'm a little worried that Sema's language-level notion of canThrow doesn't precisely match things which CodeGen to an "invoke" instruction.  I don't have a counterexample, though.

canThrow is potentially a bit expensive because it needs to walk all the children.

Can you briefly explain why the canThrow() check is necessary?

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


More information about the llvm-branch-commits mailing list