From 5e7032e9bc20fdd79c683f6f3514cd5a50f449c9 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Thu, 13 Nov 2025 14:31:05 -0800 Subject: [PATCH 1/2] [CIR][NFC] Add missing code markers for Dtor_VectorDeleting This adds some minimal code to mark locations where handling is needed for Dtor_VectorDeleting type dtors, which were added in https://github.com/llvm/llvm-project/pull/165598 This is not a comprehensive mark-up of the missing code, as some code will be needed in places where the surrounding function has larger missing pieces in CIR currently. This fixes a warning for an uncovered switch case that was causing CI builds to fail. --- clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp | 7 +++++++ clang/lib/CIR/CodeGen/CIRGenFunction.cpp | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp b/clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp index ac126965a95a5..fec51347cad0e 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp @@ -708,6 +708,13 @@ void CIRGenFunction::emitCXXDeleteExpr(const CXXDeleteExpr *e) { deleteTy = getContext().getBaseElementType(deleteTy); ptr = ptr.withElementType(builder, convertTypeForMem(deleteTy)); + if (e->isArrayForm() && + cgm.getContext().getTargetInfo().emitVectorDeletingDtors( + cgm.getContext().getLangOpts())) { + cgm.errorNYI(e->getSourceRange(), + "emitCXXDeleteExpr: emitVectorDeletingDtors"); + } + if (e->isArrayForm()) { assert(!cir::MissingFeatures::deleteArray()); cgm.errorNYI(e->getSourceRange(), "emitCXXDeleteExpr: array delete"); diff --git a/clang/lib/CIR/CodeGen/CIRGenFunction.cpp b/clang/lib/CIR/CodeGen/CIRGenFunction.cpp index b73071af2a5d4..885a32cf16862 100644 --- a/clang/lib/CIR/CodeGen/CIRGenFunction.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenFunction.cpp @@ -738,7 +738,9 @@ void CIRGenFunction::emitDestructorBody(FunctionArgList &args) { // outside of the function-try-block, which means it's always // possible to delegate the destructor body to the complete // destructor. Do so. - if (dtorType == Dtor_Deleting) { + if (dtorType == Dtor_Deleting || dtorType == Dtor_VectorDeleting) { + if (cxxStructorImplicitParamValue && dtorType == Dtor_VectorDeleting) + cgm.errorNYI(dtor->getSourceRange(), "emitConditionalArrayDtorCall"); RunCleanupsScope dtorEpilogue(*this); enterDtorCleanups(dtor, Dtor_Deleting); if (haveInsertPoint()) { @@ -771,6 +773,7 @@ void CIRGenFunction::emitDestructorBody(FunctionArgList &args) { case Dtor_Comdat: llvm_unreachable("not expecting a COMDAT"); case Dtor_Deleting: + case Dtor_VectorDeleting: llvm_unreachable("already handled deleting case"); case Dtor_Complete: From 93e929ef23448be6cab29dd6eb76ae1d8d77c5ec Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Thu, 13 Nov 2025 15:09:37 -0800 Subject: [PATCH 2/2] Fix build issue --- clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp b/clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp index fec51347cad0e..007d873ff5db6 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp @@ -709,8 +709,8 @@ void CIRGenFunction::emitCXXDeleteExpr(const CXXDeleteExpr *e) { ptr = ptr.withElementType(builder, convertTypeForMem(deleteTy)); if (e->isArrayForm() && - cgm.getContext().getTargetInfo().emitVectorDeletingDtors( - cgm.getContext().getLangOpts())) { + cgm.getASTContext().getTargetInfo().emitVectorDeletingDtors( + cgm.getASTContext().getLangOpts())) { cgm.errorNYI(e->getSourceRange(), "emitCXXDeleteExpr: emitVectorDeletingDtors"); }