Skip to content

Commit e6633f3

Browse files
committed
Address code review comments
1 parent 9453b1a commit e6633f3

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4525,7 +4525,7 @@ def CIR_CatchParamOp : CIR_Op<"catch_param"> {
45254525
let assemblyFormat = [{
45264526
($kind^)?
45274527
($exception_ptr^)?
4528-
(`->` qualified(type($param))^)?
4528+
(`:` qualified(type($param))^)?
45294529
attr-dict
45304530
}];
45314531

clang/lib/CIR/Dialect/IR/CIRDialect.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3104,12 +3104,12 @@ LogicalResult cir::CatchParamOp::verify() {
31043104
std::optional<cir::CatchParamKind> kind = getKind();
31053105
if (getExceptionPtr()) {
31063106
if (!kind || *kind != cir::CatchParamKind::Begin)
3107-
return emitOpError("needs 'begin' to work with exception pointer");
3107+
return emitOpError("with exception pointer must be of `begin` kind");
31083108
return success();
31093109
}
31103110

31113111
if (!kind && !(*this)->getParentOfType<cir::TryOp>())
3112-
return emitOpError("without 'kind' requires 'cir.try' surrounding scope");
3112+
return emitOpError("without `kind` requires `cir.try` surrounding scope");
31133113
return success();
31143114
}
31153115

clang/test/CIR/IR/catch-param.cir

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ cir.func dso_local @catch_param_inside_catch() {
1010
cir.try {
1111
cir.yield
1212
} catch all {
13-
cir.catch_param -> !cir.ptr<!void>
13+
cir.catch_param : !cir.ptr<!void>
1414
cir.yield
1515
}
1616
}
@@ -22,7 +22,7 @@ cir.func dso_local @catch_param_inside_catch() {
2222
// CHECK: cir.try {
2323
// CHECK: cir.yield
2424
// CHECK: } catch all {
25-
// CHECK: cir.catch_param -> !cir.ptr<!void>
25+
// CHECK: cir.catch_param : !cir.ptr<!void>
2626
// CHECK: cir.yield
2727
// CHECK: }
2828
// CHECK: }
@@ -34,20 +34,19 @@ cir.func dso_local @catch_begin_and_end() {
3434
%tmp_exn_ptr = cir.load %exn_addr : !cir.ptr<!cir.ptr<!void>>, !cir.ptr<!void>
3535
cir.br ^bb1(%tmp_exn_ptr : !cir.ptr<!void>)
3636
^bb1(%exn_ptr : !cir.ptr<!void>):
37-
%begin = cir.catch_param begin %exn_ptr -> !cir.ptr<!s32i>
37+
%begin = cir.catch_param begin %exn_ptr : !cir.ptr<!s32i>
3838
cir.catch_param end
3939
cir.br ^bb2
4040
^bb2:
4141
cir.return
4242
}
4343

44-
4544
// CHECK: cir.func dso_local @catch_begin_and_end() {
4645
// CHECK: %[[EXN_ADDR:.*]] = cir.alloca !cir.ptr<!void>, !cir.ptr<!cir.ptr<!void>>, ["exn_addr"]
4746
// CHECK: %[[TMP_EXN_PTR:.*]] = cir.load %[[EXN_ADDR]] : !cir.ptr<!cir.ptr<!void>>, !cir.ptr<!void>
4847
// CHECK: cir.br ^bb1(%[[TMP_EXN_PTR]] : !cir.ptr<!void>)
4948
// CHECK: ^bb1(%[[EXN_PTR:.*]]: !cir.ptr<!void>):
50-
// CHECK: %[[BEGIN:.*]] = cir.catch_param begin %[[EXN_PTR]] -> !cir.ptr<!s32i>
49+
// CHECK: %[[BEGIN:.*]] = cir.catch_param begin %[[EXN_PTR]] : !cir.ptr<!s32i>
5150
// CHECK: cir.catch_param end
5251
// CHECK: cir.br ^bb2
5352
// CHECK: ^bb2:

clang/test/CIR/IR/invalid-catch-param.cir

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
module {
77

88
cir.func dso_local @catch_param_without_kind_and_without_try_scope() {
9-
// expected-error @below {{'cir.catch_param' op without 'kind' requires 'cir.try' surrounding scope}}
10-
%0 = cir.catch_param -> !cir.ptr<!void>
9+
// expected-error @below {{op without `kind` requires `cir.try` surrounding scope}}
10+
%0 = cir.catch_param : !cir.ptr<!void>
1111
cir.return
1212
}
1313

@@ -28,8 +28,8 @@ cir.func dso_local @catch_param_with_exception_ptr_but_without_kind() {
2828
cir.yield
2929
} catch all {
3030
%0 = cir.const #cir.ptr<null> : !cir.ptr<!void>
31-
// expected-error @below {{'cir.catch_param' op needs 'begin' to work with exception pointer}}
32-
%1 = cir.catch_param %0 -> !cir.ptr<!void>
31+
// expected-error @below {{op with exception pointer must be of `begin` kind}}
32+
%1 = cir.catch_param %0 : !cir.ptr<!void>
3333
cir.yield
3434
}
3535
}
@@ -53,8 +53,8 @@ cir.func dso_local @catch_param_with_exception_ptr_but_with_end_kind() {
5353
cir.yield
5454
} catch all {
5555
%0 = cir.const #cir.ptr<null> : !cir.ptr<!void>
56-
// expected-error @below {{'cir.catch_param' op needs 'begin' to work with exception pointer}}
57-
%1 = cir.catch_param end %0 -> !cir.ptr<!void>
56+
// expected-error @below {{'cir.catch_param' op with exception pointer must be of `begin` kind}}
57+
%1 = cir.catch_param end %0 : !cir.ptr<!void>
5858
cir.yield
5959
}
6060
}

0 commit comments

Comments
 (0)