Skip to content
This repository was archived by the owner on Jun 20, 2019. It is now read-only.

Commit b094e72

Browse files
committed
Always emit call to LIBCALL_BEGIN_CATCH at the start of the catch
1 parent 7e551d4 commit b094e72

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

gcc/d/ChangeLog

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2015-08-22 Iain Buclaw <[email protected]>
2+
3+
* toir.cc(IRVisitor::visit(TryCatchStatement)): Always emit call to
4+
LIBCALL_BEGIN_CATCH at the start of the catch.
5+
16
2015-08-20 Iain Buclaw <[email protected]>
27

38
* toir.cc(IRVisitor::visit): Set input location in all visitors that

gcc/d/toir.cc

+12-5
Original file line numberDiff line numberDiff line change
@@ -785,13 +785,14 @@ class IRVisitor : public Visitor
785785
this->start_scope(level_catch);
786786

787787
tree catchtype = build_ctype(vcatch->type);
788+
789+
// Get D's internal exception Object, different from the generic
790+
// exception pointer returned from gcc runtime.
791+
tree ehptr = d_build_call_nary(builtin_decl_explicit(BUILT_IN_EH_POINTER),
792+
1, integer_zero_node);
793+
tree object = build_libcall(LIBCALL_BEGIN_CATCH, 1, &ehptr);
788794
if (vcatch->var)
789795
{
790-
// Get D's internal exception Object, different
791-
// from the generic exception pointer.
792-
tree ehptr = d_build_call_nary(builtin_decl_explicit(BUILT_IN_EH_POINTER),
793-
1, integer_zero_node);
794-
tree object = build_libcall(LIBCALL_BEGIN_CATCH, 1, &ehptr);
795796
object = build1(NOP_EXPR, build_ctype(build_object_type()), object);
796797
object = convert_expr(object, build_object_type(), vcatch->type);
797798

@@ -801,6 +802,12 @@ class IRVisitor : public Visitor
801802
build_local_var(vcatch->var);
802803
add_stmt(init);
803804
}
805+
else
806+
{
807+
// Still need to emit a call to __gdc_begin_catch() to remove
808+
// the object from the uncaught exceptions list.
809+
add_stmt(object);
810+
}
804811

805812
if (vcatch->handler)
806813
vcatch->handler->accept(this);

0 commit comments

Comments
 (0)