Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion clang/include/clang/CIR/Dialect/IR/CIROps.td
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,8 @@ def StoreOp : CIR_Op<"store", [

def ReturnOp : CIR_Op<"return", [ParentOneOf<["FuncOp", "ScopeOp", "IfOp",
"SwitchOp", "DoWhileOp",
"WhileOp", "ForOp", "CaseOp"]>,
"WhileOp", "ForOp", "CaseOp",
"TryOp"]>,
Terminator]> {
let summary = "Return from function";
let description = [{
Expand Down
21 changes: 21 additions & 0 deletions clang/test/CIR/CodeGen/try-catch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,24 @@ void tc5() {
// CHECK: cir.call exception @_Z3tc5v() : () -> ()
// CHECK: cir.yield
// CHECK: }]

// CHECK: cir.func @_Z3tc6v()
void tc6() {
int r = 1;
try {
return;
++r;
} catch (...) {
}
}

// CHECK: cir.scope {
// CHECK: cir.try {
// CHECK: cir.return
// CHECK: ^bb1: // no predecessors
// CHECK: %[[V2:.*]] = cir.load {{.*}} : !cir.ptr<!s32i>, !s32i
// CHECK: %[[V3:.*]] = cir.unary(inc, %[[V2]]) : !s32i, !s32i
// CHECK: cir.store %[[V3]], {{.*}} : !s32i, !cir.ptr<!s32i>
// CHECK: cir.yield
// CHECK: }
// CHECK: }
Loading