Author: Timm Baeder Date: 2025-08-26T11:25:46+02:00 New Revision: 9df7824e19ea50e25944f385bfc4ced2b6cef50b
URL: https://github.com/llvm/llvm-project/commit/9df7824e19ea50e25944f385bfc4ced2b6cef50b DIFF: https://github.com/llvm/llvm-project/commit/9df7824e19ea50e25944f385bfc4ced2b6cef50b.diff LOG: [clang][bytecode][NFC] Check InitializingBlocks in _within_lifetime (#155378) This kind of check is exactly why InterpState::InitializingBlocks exists. Added: Modified: clang/lib/AST/ByteCode/InterpBuiltin.cpp Removed: ################################################################################ diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp index e245f24e614e5..cec3c9b33d453 100644 --- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp +++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp @@ -2505,12 +2505,8 @@ static bool interp__builtin_is_within_lifetime(InterpState &S, CodePtr OpPC, } // Check if we're currently running an initializer. - for (InterpFrame *Frame = S.Current; Frame; Frame = Frame->Caller) { - if (const Function *F = Frame->getFunction(); - F && F->isConstructor() && Frame->getThis().block() == Ptr.block()) { - return Error(2); - } - } + if (llvm::is_contained(S.InitializingBlocks, Ptr.block())) + return Error(2); if (S.EvaluatingDecl && Ptr.getDeclDesc()->asVarDecl() == S.EvaluatingDecl) return Error(2); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits