Skip to content

Commit 048cda1

Browse files
committed
Address code review comments
1 parent 0243dba commit 048cda1

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

clang/include/clang/CIR/MissingFeatures.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ struct MissingFeatures {
9494
static bool opFuncNoReturn() { return false; }
9595
static bool setFunctionAttributes() { return false; }
9696
static bool setLLVMFunctionFEnvAttributes() { return false; }
97+
static bool setFunctionPersonality() { return false; }
9798

9899
// CallOp handling
99100
static bool opCallAggregateArgs() { return false; }
@@ -339,7 +340,6 @@ struct MissingFeatures {
339340
static bool awaitOp() { return false; }
340341
static bool callOp() { return false; }
341342
static bool ifOp() { return false; }
342-
static bool invokeOp() { return false; }
343343
static bool labelOp() { return false; }
344344
static bool ptrDiffOp() { return false; }
345345
static bool llvmLoweringPtrDiffConsidersPointee() { return false; }

clang/lib/CIR/CodeGen/CIRGenCall.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,8 +636,6 @@ RValue CIRGenFunction::emitCall(const CIRGenFunctionInfo &funcInfo,
636636
assert(!cir::MissingFeatures::opCallAttrs());
637637
cgm.constructAttributeList(callee.getAbstractInfo(), attrs);
638638

639-
assert(!cir::MissingFeatures::invokeOp());
640-
641639
cir::FuncType indirectFuncTy;
642640
mlir::Value indirectFuncVal;
643641
cir::FuncOp directFuncOp;

clang/lib/CIR/CodeGen/CIRGenException.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,10 @@ void CIRGenFunction::populateEHCatchRegions(EHScopeStack::stable_iterator scope,
612612
ehScope.setMayThrow(mayThrow);
613613
}
614614

615+
// in classic codegen this function is mapping to `isInvokeDest` previously and
616+
// currently it's mapping to the conditions that performs early returns in
617+
// `getInvokeDestImpl`, in CIR we need the condition to know if the EH scope may
618+
// throw exception or now.
615619
bool CIRGenFunction::isCatchOrCleanupRequired() {
616620
if (!ehStack.requiresCatchOrCleanup())
617621
return false;
@@ -633,11 +637,14 @@ bool CIRGenFunction::isCatchOrCleanupRequired() {
633637
return true;
634638
}
635639

640+
// In classic codegen this function is equivalent to `getInvokeDestImpl`, in
641+
// ClangIR we don't need to return to return any landing pad, we just need to
642+
// populate the catch handlers if they are required
636643
void CIRGenFunction::populateCatchHandlersIfRequired(cir::TryOp tryOp) {
637644
assert(ehStack.requiresCatchOrCleanup());
638645
assert(!ehStack.empty());
639646

640-
// TODO(cir): add personality function
647+
assert(!cir::MissingFeatures::setFunctionPersonality());
641648

642649
// CIR does not cache landing pads.
643650
const EHPersonality &personality = EHPersonality::get(*this);

0 commit comments

Comments
 (0)