[clang] [CIR][NFC] Convert MissingFeatures::requiresCleanups to errorNYI (PR #192350)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 15 14:49:21 PDT 2026
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/192350
This change adds errorNYI calls in two places that we previously had requiresCleanups() missing features markers, adds a more specific missing feature marker for loops, removes one requiresCleanups() where the handling was already implemented, and deletes a bunch of missing feature markers there were never used.
>From e93062e4ce7b275a19ca7534093e901ce593b5e1 Mon Sep 17 00:00:00 2001
From: Andy Kaylor <akaylor at nvidia.com>
Date: Wed, 15 Apr 2026 13:13:16 -0700
Subject: [PATCH] [CIR][NFC] Convert MissingFeatures::requiresCleanups to
errorNYI
This change adds errorNYI calls in two places that we previously
had requiresCleanups() missing features markers, adds a more
specific missing feature marker for loops, removes one
requiresCleanups() where the handling was already implemented,
and deletes a bunch of missing feature markers there were never
used.
---
clang/include/clang/CIR/MissingFeatures.h | 7 +------
clang/lib/CIR/CodeGen/CIRGenClass.cpp | 7 ++++---
clang/lib/CIR/CodeGen/CIRGenExprAggregate.cpp | 2 --
clang/lib/CIR/CodeGen/CIRGenStmt.cpp | 8 ++++----
4 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/clang/include/clang/CIR/MissingFeatures.h b/clang/include/clang/CIR/MissingFeatures.h
index ac02433fb504a..9fd9397e85e63 100644
--- a/clang/include/clang/CIR/MissingFeatures.h
+++ b/clang/include/clang/CIR/MissingFeatures.h
@@ -227,10 +227,7 @@ struct MissingFeatures {
static bool checkBitfieldClipping() { return false; }
static bool cirgenABIInfo() { return false; }
static bool cleanupAfterErrorDiags() { return false; }
- static bool cleanupAppendInsts() { return false; }
- static bool cleanupBranchThrough() { return false; }
static bool cleanupDeactivationScope() { return false; }
- static bool cleanupIndexAndBIAdjustment() { return false; }
static bool cleanupWithPreservedValues() { return false; }
static bool cleanupsToDeactivate() { return false; }
static bool constEmitterAggILE() { return false; }
@@ -256,7 +253,6 @@ struct MissingFeatures {
static bool devirtualizeMemberFunction() { return false; }
static bool dtorCleanups() { return false; }
static bool ehCleanupScope() { return false; }
- static bool ehCleanupScopeRequiresEHCleanup() { return false; }
static bool ehScopeFilter() { return false; }
static bool emitCheckedInBoundsGEP() { return false; }
static bool emitCondLikelihoodViaExpectIntrinsic() { return false; }
@@ -319,7 +315,7 @@ struct MissingFeatures {
static bool pointerAuthentication() { return false; }
static bool pointerOverflowSanitizer() { return false; }
static bool preservedAccessIndexRegion() { return false; }
- static bool requiresCleanups() { return false; }
+ static bool loopSpecificCleanupHandling() { return false; }
static bool returnValueSlotFeatures() { return false; }
static bool runCleanupsScope() { return false; }
static bool sanitizers() { return false; }
@@ -329,7 +325,6 @@ struct MissingFeatures {
static bool shouldSplitConstantStore() { return false; }
static bool shouldUseBZeroPlusStoresToInitialize() { return false; }
static bool shouldUseMemSetToInitialize() { return false; }
- static bool simplifyCleanupEntry() { return false; }
static bool sourceLanguageCases() { return false; }
static bool stackBase() { return false; }
static bool stackSaveOp() { return false; }
diff --git a/clang/lib/CIR/CodeGen/CIRGenClass.cpp b/clang/lib/CIR/CodeGen/CIRGenClass.cpp
index 1d4be8c7dd7a3..9c84fe574be45 100644
--- a/clang/lib/CIR/CodeGen/CIRGenClass.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenClass.cpp
@@ -285,7 +285,8 @@ void CIRGenFunction::emitBaseInitializer(mlir::Location loc,
emitAggExpr(baseInit->getInit(), aggSlot);
- assert(!cir::MissingFeatures::requiresCleanups());
+ if (cgm.getLangOpts().Exceptions && !baseClassDecl->hasTrivialDestructor())
+ cgm.errorNYI(baseInit->getSourceRange(), "call base destructor");
}
/// This routine generates necessary code to initialize base classes and
@@ -618,8 +619,8 @@ void CIRGenFunction::emitInitializerForField(FieldDecl *field, LValue lhs,
// Ensure that we destroy this object if an exception is thrown later in the
// constructor.
QualType::DestructionKind dtorKind = fieldType.isDestructedType();
- (void)dtorKind;
- assert(!cir::MissingFeatures::requiresCleanups());
+ if (needsEHCleanup(dtorKind))
+ cgm.errorNYI(init->getSourceRange(), "call field destructor");
}
Address CIRGenFunction::emitCXXMemberDataPointerAddress(
diff --git a/clang/lib/CIR/CodeGen/CIRGenExprAggregate.cpp b/clang/lib/CIR/CodeGen/CIRGenExprAggregate.cpp
index 37157e8c2d065..8614df5d7dfdd 100644
--- a/clang/lib/CIR/CodeGen/CIRGenExprAggregate.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenExprAggregate.cpp
@@ -813,8 +813,6 @@ void AggExprEmitter::emitArrayInit(Address destPtr, cir::ArrayType arrayTy,
[&](mlir::OpBuilder &b, mlir::Location loc) {
cir::LoadOp currentElement = builder.createLoad(loc, tmpAddr);
- assert(!cir::MissingFeatures::requiresCleanups());
-
// Emit the actual filler expression.
LValue elementLV = cgf.makeAddrLValue(
Address(currentElement, cirElementType, elementAlign),
diff --git a/clang/lib/CIR/CodeGen/CIRGenStmt.cpp b/clang/lib/CIR/CodeGen/CIRGenStmt.cpp
index 3b28e85167199..aa9d66f9b244e 100644
--- a/clang/lib/CIR/CodeGen/CIRGenStmt.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenStmt.cpp
@@ -933,7 +933,7 @@ CIRGenFunction::emitCXXForRangeStmt(const CXXForRangeStmt &s,
// scope, create a block to stage a loop exit along.
// We probably already do the right thing because of ScopeOp, but make
// sure we handle all cases.
- assert(!cir::MissingFeatures::requiresCleanups());
+ assert(!cir::MissingFeatures::loopSpecificCleanupHandling());
forOp = builder.createFor(
getLoc(s.getSourceRange()),
@@ -1001,7 +1001,7 @@ mlir::LogicalResult CIRGenFunction::emitForStmt(const ForStmt &s) {
// loop-exit scope, a block is created to stage the loop exit. We probably
// already do the right thing because of ScopeOp, but we need more testing
// to be sure we handle all cases.
- assert(!cir::MissingFeatures::requiresCleanups());
+ assert(!cir::MissingFeatures::loopSpecificCleanupHandling());
forOp = builder.createFor(
getLoc(s.getSourceRange()),
@@ -1069,7 +1069,7 @@ mlir::LogicalResult CIRGenFunction::emitDoStmt(const DoStmt &s) {
// scope, create a block to stage a loop exit along.
// We probably already do the right thing because of ScopeOp, but make
// sure we handle all cases.
- assert(!cir::MissingFeatures::requiresCleanups());
+ assert(!cir::MissingFeatures::loopSpecificCleanupHandling());
doWhileOp = builder.createDoWhile(
getLoc(s.getSourceRange()),
@@ -1120,7 +1120,7 @@ mlir::LogicalResult CIRGenFunction::emitWhileStmt(const WhileStmt &s) {
// scope, create a block to stage a loop exit along.
// We probably already do the right thing because of ScopeOp, but make
// sure we handle all cases.
- assert(!cir::MissingFeatures::requiresCleanups());
+ assert(!cir::MissingFeatures::loopSpecificCleanupHandling());
whileOp = builder.createWhile(
getLoc(s.getSourceRange()),
More information about the cfe-commits
mailing list