Skip to content

Commit a1061f4

Browse files
committed
Address code review comments
1 parent 4918035 commit a1061f4

File tree

5 files changed

+3
-39
lines changed

5 files changed

+3
-39
lines changed

clang/include/clang/CIR/Dialect/IR/CIROps.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4177,7 +4177,7 @@ def CIR_AllocExceptionOp : CIR_Op<"alloc.exception"> {
41774177

41784178
`void *__cxa_allocate_exception(size_t thrown_size);`
41794179

4180-
If operation fails, program terminates, not throw.
4180+
If the operation fails, the program terminates rather than throw.
41814181

41824182
Example:
41834183

clang/lib/CIR/CodeGen/CIRGenCleanup.cpp

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -178,36 +178,3 @@ void CIRGenFunction::popCleanupBlocks(
178178
popCleanupBlock();
179179
}
180180
}
181-
182-
void CIRGenFunction::deactivateCleanupBlock(
183-
EHScopeStack::stable_iterator cleanup, mlir::Operation *dominatingIP) {
184-
assert(cleanup != ehStack.stable_end() && "deactivating bottom of stack?");
185-
EHCleanupScope &scope = cast<EHCleanupScope>(*ehStack.find(cleanup));
186-
assert(scope.isActive() && "double deactivation");
187-
188-
// If it's the top of the stack, just pop it, but do so only if it belongs
189-
// to the current RunCleanupsScope.
190-
if (cleanup == ehStack.stable_begin() &&
191-
currentCleanupStackDepth.strictlyEncloses(cleanup)) {
192-
193-
// Per comment below, checking EHAsynch is not really necessary
194-
// it's there to assure zero-impact w/o EHAsynch option
195-
if (!scope.isNormalCleanup() && getLangOpts().EHAsynch) {
196-
cgm.errorNYI("deactivateCleanupBlock: EHAsynch & non-normal cleanup");
197-
return;
198-
}
199-
200-
// From LLVM: If it's a normal cleanup, we need to pretend that the
201-
// fallthrough is unreachable.
202-
// CIR remarks: LLVM uses an empty insertion point to signal behavior
203-
// change to other codegen paths (triggered by PopCleanupBlock).
204-
// CIRGen doesn't do that yet, but let's mimic just in case.
205-
mlir::OpBuilder::InsertionGuard guard(builder);
206-
builder.clearInsertionPoint();
207-
popCleanupBlock();
208-
return;
209-
}
210-
211-
// Otherwise, follow the general case.
212-
cgm.errorNYI("deactivateCleanupBlock: the general case");
213-
}

clang/lib/CIR/CodeGen/CIRGenCleanup.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ class alignas(EHScopeStack::ScopeStackAlignment) EHCleanupScope
104104
bool isNormalCleanup() const { return cleanupBits.isNormalCleanup; }
105105

106106
bool isActive() const { return cleanupBits.isActive; }
107+
void setActive(bool isActive) { cleanupBits.isActive = isActive; }
107108

108109
size_t getCleanupSize() const { return cleanupBits.cleanupSize; }
109110
void *getCleanupBuffer() { return this + 1; }

clang/lib/CIR/CodeGen/CIRGenFunction.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,9 +1092,6 @@ class CIRGenFunction : public CIRGenTypeCache {
10921092

10931093
void emitAnyExprToExn(const Expr *e, Address addr);
10941094

1095-
void deactivateCleanupBlock(EHScopeStack::stable_iterator cleanup,
1096-
mlir::Operation *dominatingIP);
1097-
10981095
void emitArrayDestroy(mlir::Value begin, mlir::Value numElements,
10991096
QualType elementType, CharUnits elementAlign,
11001097
Destroyer *destroyer);

clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,10 +1571,9 @@ void CIRGenItaniumCXXABI::emitThrow(CIRGenFunction &cgf,
15711571
cgf.emitAnyExprToExn(e->getSubExpr(), Address(exceptionPtr, exnAlign));
15721572

15731573
// Get the RTTI symbol address.
1574-
auto typeInfo = mlir::dyn_cast_if_present<cir::GlobalViewAttr>(
1574+
auto typeInfo = mlir::cast<cir::GlobalViewAttr>(
15751575
cgm.getAddrOfRTTIDescriptor(subExprLoc, clangThrowType,
15761576
/*forEH=*/true));
1577-
assert(typeInfo && "expected GlobalViewAttr typeinfo");
15781577
assert(!typeInfo.getIndices() && "expected no indirection");
15791578

15801579
// The address of the destructor.

0 commit comments

Comments
 (0)