@@ -472,7 +472,6 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
472
472
}
473
473
else {
474
474
// 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
476
475
println ! ( "Try/catch in {:?}" , self . current_func( ) ) ;
477
476
self . block . add_try_catch ( None , try_block, catch) ;
478
477
}
@@ -1220,15 +1219,6 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
1220
1219
1221
1220
self . cleanup_blocks . borrow_mut ( ) . insert ( self . block ) ;
1222
1221
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.
1232
1222
let eh_pointer_builtin = self . cx . context . get_target_builtin_function ( "__builtin_eh_pointer" ) ;
1233
1223
let zero = self . cx . context . new_rvalue_zero ( self . int_type ) ;
1234
1224
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> {
1242
1232
self . block . add_assignment ( None , value. access_field ( None , field1) , ptr) ;
1243
1233
self . block . add_assignment ( None , value. access_field ( None , field2) , zero) ; // TODO: set the proper value here (the type of exception?).
1244
1234
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
-
1254
1235
value. to_rvalue ( )
1255
1236
}
1256
1237
1257
1238
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 ( ) ;
1258
1241
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.
1260
1243
let unwind_resume = self . context . new_function ( None , FunctionType :: Extern , self . type_void ( ) , & [ param] , "_Unwind_Resume" , false ) ;
1261
1244
self . llbb ( ) . add_eval ( None , self . context . new_call ( None , unwind_resume, & [ exn] ) ) ;
1262
1245
self . unreachable ( ) ;
0 commit comments