mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 10:54:49 +01:00
Make Destroy.Op functions able to have a body (#6729)
This is iterating on how `Destroy.Op` generates, to start adding body capabilities. This changes the way the signature is created, and adds a `CoreWitness` function kind so that mangling can prevent name collisions. The result is that what _was_ `DestroyOp` is now `Core.Destroy.Op` or, as can be seen in toolchain/lower/testdata/interop/cpp/nullptr.carbon, `_COp.<hash>:core.Destroy.Core` where `:core` is indicating that it's a core witness (taking a note from `:thunk`). Assisted-by: Google Antigravity with Gemini 3 Flash
This commit is contained in:
+5
-5
@@ -563,8 +563,8 @@ fn F() {
|
||||
// CHECK:STDOUT: %ExplicitAndAlsoDeduced.specific_fn.1f3: <specific function> = specific_function %ExplicitAndAlsoDeduced, @ExplicitAndAlsoDeduced(%A) [concrete]
|
||||
// CHECK:STDOUT: %A.val: %A = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
|
||||
// CHECK:STDOUT: %DestroyOp.type: type = fn_type @DestroyOp [concrete]
|
||||
// CHECK:STDOUT: %DestroyOp: %DestroyOp.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.type: type = fn_type @Destroy.Op [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op: %Destroy.Op.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %complete_type.8a0: <witness> = complete_type_witness %ptr.643 [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -662,12 +662,12 @@ fn F() {
|
||||
// CHECK:STDOUT: %.loc11_37.5: ref %A = converted %.loc11_37.1, %.loc11_37.4
|
||||
// CHECK:STDOUT: %.loc11_37.6: %A = acquire_value %.loc11_37.5
|
||||
// CHECK:STDOUT: %ExplicitAndAlsoDeduced.call: init %ptr.643 = call %ExplicitAndAlsoDeduced.specific_fn(%.loc11_37.6)
|
||||
// CHECK:STDOUT: %DestroyOp.bound: <bound method> = bound_method %.loc11_37.4, constants.%DestroyOp
|
||||
// CHECK:STDOUT: %DestroyOp.call: init %empty_tuple.type = call %DestroyOp.bound(%.loc11_37.4)
|
||||
// CHECK:STDOUT: %Destroy.Op.bound: <bound method> = bound_method %.loc11_37.4, constants.%Destroy.Op
|
||||
// CHECK:STDOUT: %Destroy.Op.call: init %empty_tuple.type = call %Destroy.Op.bound(%.loc11_37.4)
|
||||
// CHECK:STDOUT: return %ExplicitAndAlsoDeduced.call
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @DestroyOp(%self.param: ref %A) = "no_op";
|
||||
// CHECK:STDOUT: fn @Destroy.Op(%self.param: ref %A) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @ExplicitAndAlsoDeduced(constants.%T) {
|
||||
// CHECK:STDOUT: %T.loc6_27.1 => constants.%T
|
||||
|
||||
+13
-13
@@ -69,12 +69,12 @@ fn CallNegative() {
|
||||
// CHECK:STDOUT: %i0: type = class_type @Int, @Int(%int_0) [concrete]
|
||||
// CHECK:STDOUT: %complete_type.d94: <witness> = complete_type_witness <error> [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.47b: type = pattern_type %i0 [concrete]
|
||||
// CHECK:STDOUT: %DestroyOp.type: type = fn_type @DestroyOp [concrete]
|
||||
// CHECK:STDOUT: %DestroyOp: %DestroyOp.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.809: <witness> = custom_witness (%DestroyOp), @Destroy [concrete]
|
||||
// CHECK:STDOUT: %Destroy.facet.7e1: %Destroy.type = facet_value %i0, (%custom_witness.809) [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.type.e5a: type = fn_type @Destroy.WithSelf.Op, @Destroy.WithSelf(%Destroy.facet.7e1) [concrete]
|
||||
// CHECK:STDOUT: %.011: type = fn_type_with_self_type %Destroy.WithSelf.Op.type.e5a, %Destroy.facet.7e1 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.type: type = fn_type @Destroy.Op [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op: %Destroy.Op.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.8d7: <witness> = custom_witness (%Destroy.Op), @Destroy [concrete]
|
||||
// CHECK:STDOUT: %Destroy.facet.eb2: %Destroy.type = facet_value %i0, (%custom_witness.8d7) [concrete]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.type.cef: type = fn_type @Destroy.WithSelf.Op, @Destroy.WithSelf(%Destroy.facet.eb2) [concrete]
|
||||
// CHECK:STDOUT: %.98d: type = fn_type_with_self_type %Destroy.WithSelf.Op.type.cef, %Destroy.facet.eb2 [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
@@ -159,7 +159,7 @@ fn CallNegative() {
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @DestroyOp(%self.param: ref %i0) = "no_op";
|
||||
// CHECK:STDOUT: fn @Destroy.Op(%self.param: ref %i0) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @ErrorIfNIsZero(constants.%N) {
|
||||
// CHECK:STDOUT: %N.loc4_19.1 => constants.%N
|
||||
@@ -172,11 +172,11 @@ fn CallNegative() {
|
||||
// CHECK:STDOUT: %Int.loc9_27.2 => constants.%i0
|
||||
// CHECK:STDOUT: %require_complete => constants.%complete_type.d94
|
||||
// CHECK:STDOUT: %pattern_type => constants.%pattern_type.47b
|
||||
// CHECK:STDOUT: %Destroy.lookup_impl_witness => constants.%custom_witness.809
|
||||
// CHECK:STDOUT: %Destroy.facet => constants.%Destroy.facet.7e1
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.type => constants.%Destroy.WithSelf.Op.type.e5a
|
||||
// CHECK:STDOUT: %.loc9_3 => constants.%.011
|
||||
// CHECK:STDOUT: %impl.elem0.loc9_3.2 => constants.%DestroyOp
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc9_3.2 => constants.%DestroyOp
|
||||
// CHECK:STDOUT: %Destroy.lookup_impl_witness => constants.%custom_witness.8d7
|
||||
// CHECK:STDOUT: %Destroy.facet => constants.%Destroy.facet.eb2
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.type => constants.%Destroy.WithSelf.Op.type.cef
|
||||
// CHECK:STDOUT: %.loc9_3 => constants.%.98d
|
||||
// CHECK:STDOUT: %impl.elem0.loc9_3.2 => constants.%Destroy.Op
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc9_3.2 => constants.%Destroy.Op
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
+15
-15
@@ -77,12 +77,12 @@ fn G() {
|
||||
// CHECK:STDOUT: %.768: Core.Form = init_form %C, call_param0 [concrete]
|
||||
// CHECK:STDOUT: %Wrap.Make.specific_fn.cb9: <specific function> = specific_function %Wrap.Make.62a, @Wrap.Make(%C) [concrete]
|
||||
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
|
||||
// CHECK:STDOUT: %DestroyOp.type.3e79c2.1: type = fn_type @DestroyOp.loc24 [concrete]
|
||||
// CHECK:STDOUT: %DestroyOp.b0ebf8.1: %DestroyOp.type.3e79c2.1 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %DestroyOp.type.3e79c2.2: type = fn_type @DestroyOp.loc23 [concrete]
|
||||
// CHECK:STDOUT: %DestroyOp.b0ebf8.2: %DestroyOp.type.3e79c2.2 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %DestroyOp.type.3e79c2.3: type = fn_type @DestroyOp.loc22 [concrete]
|
||||
// CHECK:STDOUT: %DestroyOp.b0ebf8.3: %DestroyOp.type.3e79c2.3 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.type.bae255.1: type = fn_type @Destroy.Op.loc24 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.651ba6.1: %Destroy.Op.type.bae255.1 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.type.bae255.2: type = fn_type @Destroy.Op.loc23 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.651ba6.2: %Destroy.Op.type.bae255.2 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.type.bae255.3: type = fn_type @Destroy.Op.loc22 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.651ba6.3: %Destroy.Op.type.bae255.3 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %complete_type.782: <witness> = complete_type_witness %empty_tuple.type [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -232,20 +232,20 @@ fn G() {
|
||||
// CHECK:STDOUT: assign %c.var, %Wrap.Make.call.loc24
|
||||
// CHECK:STDOUT: %C.ref.loc24_17: type = name_ref C, file.%C.decl [concrete = constants.%C]
|
||||
// CHECK:STDOUT: %c: ref %C = ref_binding c, %c.var
|
||||
// CHECK:STDOUT: %DestroyOp.bound.loc24: <bound method> = bound_method %c.var, constants.%DestroyOp.b0ebf8.1
|
||||
// CHECK:STDOUT: %DestroyOp.call.loc24: init %empty_tuple.type = call %DestroyOp.bound.loc24(%c.var)
|
||||
// CHECK:STDOUT: %DestroyOp.bound.loc23: <bound method> = bound_method %b.var, constants.%DestroyOp.b0ebf8.2
|
||||
// CHECK:STDOUT: %DestroyOp.call.loc23: init %empty_tuple.type = call %DestroyOp.bound.loc23(%b.var)
|
||||
// CHECK:STDOUT: %DestroyOp.bound.loc22: <bound method> = bound_method %a.var, constants.%DestroyOp.b0ebf8.3
|
||||
// CHECK:STDOUT: %DestroyOp.call.loc22: init %empty_tuple.type = call %DestroyOp.bound.loc22(%a.var)
|
||||
// CHECK:STDOUT: %Destroy.Op.bound.loc24: <bound method> = bound_method %c.var, constants.%Destroy.Op.651ba6.1
|
||||
// CHECK:STDOUT: %Destroy.Op.call.loc24: init %empty_tuple.type = call %Destroy.Op.bound.loc24(%c.var)
|
||||
// CHECK:STDOUT: %Destroy.Op.bound.loc23: <bound method> = bound_method %b.var, constants.%Destroy.Op.651ba6.2
|
||||
// CHECK:STDOUT: %Destroy.Op.call.loc23: init %empty_tuple.type = call %Destroy.Op.bound.loc23(%b.var)
|
||||
// CHECK:STDOUT: %Destroy.Op.bound.loc22: <bound method> = bound_method %a.var, constants.%Destroy.Op.651ba6.3
|
||||
// CHECK:STDOUT: %Destroy.Op.call.loc22: init %empty_tuple.type = call %Destroy.Op.bound.loc22(%a.var)
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @DestroyOp.loc24(%self.param: ref %C) = "no_op";
|
||||
// CHECK:STDOUT: fn @Destroy.Op.loc24(%self.param: ref %C) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @DestroyOp.loc23(%self.param: ref %empty_tuple.type) = "no_op";
|
||||
// CHECK:STDOUT: fn @Destroy.Op.loc23(%self.param: ref %empty_tuple.type) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @DestroyOp.loc22(%self.param: ref %i32) = "no_op";
|
||||
// CHECK:STDOUT: fn @Destroy.Op.loc22(%self.param: ref %i32) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @Wrap(constants.%T) {
|
||||
// CHECK:STDOUT: %T.loc15_12.1 => constants.%T
|
||||
|
||||
Reference in New Issue
Block a user