@@ -3799,15 +3799,32 @@ fn invoke_fastcall(bcx: &@block_ctxt, llfn: ValueRef,
3799
3799
3800
3800
let normal_bcx = new_sub_block_ctxt ( bcx, "normal return" ) ;
3801
3801
let unwind_bcx = new_sub_block_ctxt ( bcx, "unwind" ) ;
3802
- let retval = trans_build :: FastInvoke ( bcx, llfn, llargs,
3803
- normal_bcx. llbb ,
3804
- unwind_bcx. llbb ) ;
3802
+ let retval = FastInvoke ( bcx, llfn, llargs,
3803
+ normal_bcx. llbb ,
3804
+ unwind_bcx. llbb ) ;
3805
3805
trans_landing_pad ( unwind_bcx) ;
3806
3806
ret rslt( normal_bcx, retval) ;
3807
3807
}
3808
3808
3809
3809
fn trans_landing_pad ( bcx : & @block_ctxt ) {
3810
- Unreachable ( bcx) ;
3810
+ // The landing pad return type (the type being propagated). Not sure what
3811
+ // this represents but it's determined by the personality function and
3812
+ // this is what the EH proposal example uses.
3813
+ let llretty = T_struct ( [ T_ptr ( T_i8 ( ) ) , T_i32 ( ) ] ) ;
3814
+ // The exception handling personality function. This is the C++
3815
+ // personality function __gxx_personality_v0, wrapped in our naming
3816
+ // convention.
3817
+ let personality = bcx_ccx ( bcx) . upcalls . rust_personality ;
3818
+ // The only landing pad clause will be 'cleanup'
3819
+ let clauses = 1 u;
3820
+ let llpad = LandingPad ( bcx, llretty, personality, clauses) ;
3821
+ // The landing pad result is used both for modifying the landing pad
3822
+ // in the C API and as the exception value
3823
+ let llretval = llpad;
3824
+ // The landing pad block is a cleanup
3825
+ SetCleanup ( bcx, llpad) ;
3826
+ // Continue unwinding
3827
+ Resume ( bcx, llretval) ;
3811
3828
}
3812
3829
3813
3830
fn trans_tup ( cx : & @block_ctxt , elts : & [ @ast:: expr ] , id : ast:: node_id ) ->
0 commit comments