Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit c2e83dc

Browse files
bjorn3antoyo
authored andcommitted
Destruct landing_pad return value before passing it to cg_ssa
1 parent 7c2db89 commit c2e83dc

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/builder.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
11991199
}
12001200

12011201
#[cfg(feature="master")]
1202-
fn cleanup_landing_pad(&mut self, _ty: Type<'gcc>, pers_fn: RValue<'gcc>) -> RValue<'gcc> {
1202+
fn cleanup_landing_pad(&mut self, pers_fn: RValue<'gcc>) -> (RValue<'gcc>, RValue<'gcc>) {
12031203
self.set_personality_fn(pers_fn);
12041204

12051205
// NOTE: insert the current block in a variable so that a later call to invoke knows to
@@ -1223,29 +1223,27 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
12231223
}
12241224

12251225
#[cfg(not(feature="master"))]
1226-
fn cleanup_landing_pad(&mut self, _ty: Type<'gcc>, _pers_fn: RValue<'gcc>) -> RValue<'gcc> {
1226+
fn cleanup_landing_pad(&mut self, _pers_fn: RValue<'gcc>) -> (RValue<'gcc>, RValue<'gcc>) {
12271227
let field1 = self.context.new_field(None, self.u8_type.make_pointer(), "landing_pad_field_1");
12281228
let field2 = self.context.new_field(None, self.i32_type, "landing_pad_field_1");
1229-
let struct_type = self.context.new_struct_type(None, "landing_pad", &[field1, field2]);
1230-
self.current_func().new_local(None, struct_type.as_type(), "landing_pad")
1231-
.to_rvalue()
1229+
(field1, field2)
12321230
}
12331231

12341232
#[cfg(feature="master")]
1235-
fn resume(&mut self, exn: RValue<'gcc>) {
1233+
fn resume(&mut self, exn0: RValue<'gcc>, _exn1: RValue<'gcc>) {
12361234
// TODO(antoyo): check if this is normal that we need to dereference the value.
12371235
// NOTE: the type is wrong, so in order to get a pointer for parameter, cast it to a
12381236
// pointer of pointer that is later dereferenced.
1239-
let exn_type = exn.get_type().make_pointer();
1240-
let exn = self.context.new_cast(None, exn, exn_type);
1237+
let exn_type = exn0.get_type().make_pointer();
1238+
let exn = self.context.new_cast(None, exn0, exn_type);
12411239
let exn = exn.dereference(None).to_rvalue();
12421240
let unwind_resume = self.context.get_target_builtin_function("__builtin_unwind_resume");
12431241
self.llbb().add_eval(None, self.context.new_call(None, unwind_resume, &[exn]));
12441242
self.unreachable();
12451243
}
12461244

12471245
#[cfg(not(feature="master"))]
1248-
fn resume(&mut self, _exn: RValue<'gcc>) {
1246+
fn resume(&mut self, _exn0: RValue<'gcc>, _exn1: RValue<'gcc>) {
12491247
self.unreachable();
12501248
}
12511249

0 commit comments

Comments
 (0)