This repository was archived by the owner on Jun 20, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed
Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change 1+ 2015-08-22 Iain Buclaw <ibuclaw@gdcproject.org>
2+
3+ * toir.cc(IRVisitor::visit(TryCatchStatement)): Always emit call to
4+ LIBCALL_BEGIN_CATCH at the start of the catch.
5+
162015-08-20 Iain Buclaw <ibuclaw@gdcproject.org>
27
38 * toir.cc(IRVisitor::visit): Set input location in all visitors that
Original file line number Diff line number Diff 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 );
You can’t perform that action at this time.
0 commit comments