@@ -472,7 +472,6 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
472472 }
473473 else {
474474 // FIXME: FIXME: FIXME: Seems like bad (_URC_NO_REASON) return code, perhaps because the cleanup pad was created properly.
475- // FIXME: Wrong personality function: __gcc_personality_v0
476475 println ! ( "Try/catch in {:?}" , self . current_func( ) ) ;
477476 self . block . add_try_catch ( None , try_block, catch) ;
478477 }
@@ -1220,15 +1219,6 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
12201219
12211220 self . cleanup_blocks . borrow_mut ( ) . insert ( self . block ) ;
12221221
1223- // FIXME: we're probably not creating a real cleanup pad here.
1224- // FIXME: It seems to be the actual problem:
1225- // libunwind finds a catch, so returns _URC_HANDLER_FOUND instead of _URC_CONTINUE_UNWIND.
1226- // TODO: can we generate a goto from the finally to the cleanup landing pad?
1227- // TODO: add this block to a cleanup_blocks variable and generate a try/finally instead if
1228- // the catch block for it is a cleanup block.
1229- // => NO, a cleanup is only called during unwinding.
1230- //
1231- // TODO: look at TRY_CATCH_IS_CLEANUP, CLEANUP_POINT_EXPR, WITH_CLEANUP_EXPR, CLEANUP_EH_ONLY.
12321222 let eh_pointer_builtin = self . cx . context . get_target_builtin_function ( "__builtin_eh_pointer" ) ;
12331223 let zero = self . cx . context . new_rvalue_zero ( self . int_type ) ;
12341224 let ptr = self . cx . context . new_call ( None , eh_pointer_builtin, & [ zero] ) ;
@@ -1242,21 +1232,14 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
12421232 self . block . add_assignment ( None , value. access_field ( None , field1) , ptr) ;
12431233 self . block . add_assignment ( None , value. access_field ( None , field2) , zero) ; // TODO: set the proper value here (the type of exception?).
12441234
1245- /*
1246- // Resume.
1247- let param = self.context.new_parameter(None, ptr.get_type(), "exn");
1248- // TODO: should we call __builtin_unwind_resume instead?
1249- // FIXME: should probably not called resume because it could be executed (I believe) in
1250- // normal (no exception) cases
1251- let unwind_resume = self.context.new_function(None, FunctionType::Extern, self.type_void(), &[param], "_Unwind_Resume", false);
1252- self.block.add_eval(None, self.context.new_call(None, unwind_resume, &[ptr]));*/
1253-
12541235 value. to_rvalue ( )
12551236 }
12561237
12571238 fn resume ( & mut self , exn : RValue < ' gcc > ) {
1239+ // TODO: check if this is normal that we need to dereference the value.
1240+ let exn = exn. dereference ( None ) . to_rvalue ( ) ;
12581241 let param = self . context . new_parameter ( None , exn. get_type ( ) , "exn" ) ;
1259- // TODO: should we call __builtin_unwind_resume instead?
1242+ // TODO(antoyo) : should we call __builtin_unwind_resume instead? This might actually be the same.
12601243 let unwind_resume = self . context . new_function ( None , FunctionType :: Extern , self . type_void ( ) , & [ param] , "_Unwind_Resume" , false ) ;
12611244 self . llbb ( ) . add_eval ( None , self . context . new_call ( None , unwind_resume, & [ exn] ) ) ;
12621245 self . unreachable ( ) ;
0 commit comments