Fix mangling collision for C++ class template specializations (#7269)

Carbon-side thunks (for example the `Copy`/`Destroy` witness thunks
generated for imported C++ types) are mangled by Carbon, and their names
incorporate a fingerprint of the involved types. The instruction
fingerprinter identifies a class only by its name and parent scope,
which is sufficient for Carbon classes but not for imported C++ classes:
different specializations of one class template (and other cases such as
types in anonymous namespaces) share a Carbon name and parent scope. As
a result, the thunks for two distinct specializations could mangle to
the same name, producing a single LLVM function with two definitions and
failing `verifyModule` during lowering.

When fingerprinting a class imported from C++, also include the Clang
mangled name of its type.

Test: toolchain/lower/testdata/interop/cpp/thunks.carbon gains a split
with two specializations of one class template, each requiring a thunk;
their thunks now get distinct mangled names instead of colliding.

Assisted-by: Claude Code

---------

Co-authored-by: Christopher Di Bella <cjdb.ns@gmail.com>
This commit is contained in:
Chandler Carruth
2026-05-30 08:13:00 +00:00
committed by GitHub
co-authored by Christopher Di Bella
parent 3ef128ac91
commit 8a59f2a76b
64 changed files with 4762 additions and 4330 deletions
+11 -11
View File
@@ -45,20 +45,20 @@ fn G() {
// CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
// CHECK:STDOUT: %F.cpp_overload_set.type: type = cpp_overload_set_type @F.cpp_overload_set [concrete]
// CHECK:STDOUT: %F.cpp_overload_set.value: %F.cpp_overload_set.type = cpp_overload_set_value @F.cpp_overload_set [concrete]
// CHECK:STDOUT: %.dcc: type = class_type @.1 [concrete]
// CHECK:STDOUT: %int_1.0f6: %.dcc = int_value 1 [concrete]
// CHECK:STDOUT: %.730: type = class_type @.1 [concrete]
// CHECK:STDOUT: %int_1.94f: %.730 = int_value 1 [concrete]
// CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
// CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
// CHECK:STDOUT: %C: type = class_type @C [concrete]
// CHECK:STDOUT: %C.C.cpp_overload_set.type: type = cpp_overload_set_type @C.C.cpp_overload_set [concrete]
// CHECK:STDOUT: %C.C.cpp_overload_set.value: %C.C.cpp_overload_set.type = cpp_overload_set_value @C.C.cpp_overload_set [concrete]
// CHECK:STDOUT: %ptr.dbb: type = ptr_type %C [concrete]
// CHECK:STDOUT: %ptr.3a8: type = ptr_type %C [concrete]
// CHECK:STDOUT: %C__carbon_thunk.type: type = fn_type @C__carbon_thunk [concrete]
// CHECK:STDOUT: %C__carbon_thunk: %C__carbon_thunk.type = struct_value () [concrete]
// CHECK:STDOUT: %C.F.cpp_overload_set.type: type = cpp_overload_set_type @C.F.cpp_overload_set [concrete]
// CHECK:STDOUT: %C.F.cpp_overload_set.value: %C.F.cpp_overload_set.type = cpp_overload_set_value @C.F.cpp_overload_set [concrete]
// CHECK:STDOUT: %.fd8: type = class_type @.2 [concrete]
// CHECK:STDOUT: %int_1.ea9: %.fd8 = int_value 1 [concrete]
// CHECK:STDOUT: %.149: type = class_type @.2 [concrete]
// CHECK:STDOUT: %int_1.9c2: %.149 = int_value 1 [concrete]
// CHECK:STDOUT: %C.F.type: type = fn_type @C.F [concrete]
// CHECK:STDOUT: %C.F: %C.F.type = struct_value () [concrete]
// CHECK:STDOUT: %C.cpp_destructor.type: type = fn_type @C.cpp_destructor [concrete]
@@ -68,12 +68,12 @@ fn G() {
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
// CHECK:STDOUT: .F = %F.cpp_overload_set.value
// CHECK:STDOUT: .b = %int_1.0f6
// CHECK:STDOUT: .b = %int_1.94f
// CHECK:STDOUT: .C = %C.decl
// CHECK:STDOUT: import Cpp//...
// CHECK:STDOUT: }
// CHECK:STDOUT: %F.cpp_overload_set.value: %F.cpp_overload_set.type = cpp_overload_set_value @F.cpp_overload_set [concrete = constants.%F.cpp_overload_set.value]
// CHECK:STDOUT: %int_1.0f6: %.dcc = int_value 1 [concrete = constants.%int_1.0f6]
// CHECK:STDOUT: %int_1.94f: %.730 = int_value 1 [concrete = constants.%int_1.94f]
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: } {
@@ -87,7 +87,7 @@ fn G() {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT: %C.F.cpp_overload_set.value: %C.F.cpp_overload_set.type = cpp_overload_set_value @C.F.cpp_overload_set [concrete = constants.%C.F.cpp_overload_set.value]
// CHECK:STDOUT: %int_1.ea9: %.fd8 = int_value 1 [concrete = constants.%int_1.ea9]
// CHECK:STDOUT: %int_1.9c2: %.149 = int_value 1 [concrete = constants.%int_1.9c2]
// CHECK:STDOUT: %C.F.decl: %C.F.type = fn_decl @C.F [concrete = constants.%C.F] {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: } {
@@ -104,13 +104,13 @@ fn G() {
// CHECK:STDOUT: %Cpp.ref.loc8_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %F.ref.loc8: %F.cpp_overload_set.type = name_ref F, imports.%F.cpp_overload_set.value [concrete = constants.%F.cpp_overload_set.value]
// CHECK:STDOUT: %Cpp.ref.loc8_9: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %b.ref: %.dcc = name_ref b, imports.%int_1.0f6 [concrete = constants.%int_1.0f6]
// CHECK:STDOUT: %b.ref: %.730 = name_ref b, imports.%int_1.94f [concrete = constants.%int_1.94f]
// CHECK:STDOUT: %F.call: init %empty_tuple.type = call imports.%F.decl(%b.ref)
// CHECK:STDOUT: %Cpp.ref.loc10_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %C.ref.loc10_6: type = name_ref C, imports.%C.decl [concrete = constants.%C]
// CHECK:STDOUT: %C.ref.loc10_8: %C.C.cpp_overload_set.type = name_ref C, imports.%C.C.cpp_overload_set.value [concrete = constants.%C.C.cpp_overload_set.value]
// CHECK:STDOUT: %.loc10_11.1: ref %C = temporary_storage
// CHECK:STDOUT: %addr: %ptr.dbb = addr_of %.loc10_11.1
// CHECK:STDOUT: %addr: %ptr.3a8 = addr_of %.loc10_11.1
// CHECK:STDOUT: %C__carbon_thunk.call: init %empty_tuple.type = call imports.%C__carbon_thunk.decl(%addr)
// CHECK:STDOUT: %.loc10_11.2: init %C to %.loc10_11.1 = mark_in_place_init %C__carbon_thunk.call
// CHECK:STDOUT: %.loc10_11.3: ref %C = temporary %.loc10_11.1, %.loc10_11.2
@@ -118,7 +118,7 @@ fn G() {
// CHECK:STDOUT: %bound_method: <bound method> = bound_method %.loc10_11.3, %F.ref.loc10
// CHECK:STDOUT: %Cpp.ref.loc10_15: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %C.ref.loc10_18: type = name_ref C, imports.%C.decl [concrete = constants.%C]
// CHECK:STDOUT: %e.ref: %.fd8 = name_ref e, imports.%int_1.ea9 [concrete = constants.%int_1.ea9]
// CHECK:STDOUT: %e.ref: %.149 = name_ref e, imports.%int_1.9c2 [concrete = constants.%int_1.9c2]
// CHECK:STDOUT: %.loc10_11.4: %C = acquire_value %.loc10_11.3
// CHECK:STDOUT: %C.F.call: init %empty_tuple.type = call imports.%C.F.decl(%.loc10_11.4, %e.ref)
// CHECK:STDOUT: %C.cpp_destructor.bound: <bound method> = bound_method %.loc10_11.3, constants.%C.cpp_destructor
+14 -14
View File
@@ -94,9 +94,9 @@ fn F() {
// CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
// CHECK:STDOUT: %pattern_type.0cb: type = pattern_type %i16 [concrete]
// CHECK:STDOUT: %Enum: type = class_type @Enum [concrete]
// CHECK:STDOUT: %int_0.779: %Enum = int_value 0 [concrete]
// CHECK:STDOUT: %int_0.167: %Enum = int_value 0 [concrete]
// CHECK:STDOUT: %int_0.713: %i16 = int_value 0 [concrete]
// CHECK:STDOUT: %pattern_type.9f7: type = pattern_type %Enum [concrete]
// CHECK:STDOUT: %pattern_type.361: type = pattern_type %Enum [concrete]
// CHECK:STDOUT: %int_42.20e: Core.IntLiteral = int_value 42 [concrete]
// CHECK:STDOUT: %As.type.457: type = facet_type <@As, @As(%i16)> [concrete]
// CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
@@ -112,10 +112,10 @@ fn F() {
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.As.impl.Convert.036, @Core.IntLiteral.as.As.impl.Convert(%int_16) [concrete]
// CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_42.20e, %Core.IntLiteral.as.As.impl.Convert.specific_fn [concrete]
// CHECK:STDOUT: %int_42.50d: %i16 = int_value 42 [concrete]
// CHECK:STDOUT: %int_42.7b3: %Enum = int_value 42 [concrete]
// CHECK:STDOUT: %int_42.3d1: %Enum = int_value 42 [concrete]
// CHECK:STDOUT: %Other: type = class_type @Other [concrete]
// CHECK:STDOUT: %pattern_type.da8: type = pattern_type %Other [concrete]
// CHECK:STDOUT: %int_0.9f3: %Other = int_value 0 [concrete]
// CHECK:STDOUT: %pattern_type.7cb: type = pattern_type %Other [concrete]
// CHECK:STDOUT: %int_0.10c: %Other = int_value 0 [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -126,7 +126,7 @@ fn F() {
// CHECK:STDOUT: import Cpp//...
// CHECK:STDOUT: }
// CHECK:STDOUT: %Enum.decl: type = class_decl @Enum [concrete = constants.%Enum] {} {}
// CHECK:STDOUT: %int_0: %Enum = int_value 0 [concrete = constants.%int_0.779]
// CHECK:STDOUT: %int_0: %Enum = int_value 0 [concrete = constants.%int_0.167]
// CHECK:STDOUT: %Core.import_ref.6c4: @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert.type (%Core.IntLiteral.as.As.impl.Convert.type.fc5) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert (constants.%Core.IntLiteral.as.As.impl.Convert.3a8)]
// CHECK:STDOUT: %As.impl_witness_table.2e6 = impl_witness_table (%Core.import_ref.6c4), @Core.IntLiteral.as.As.impl [concrete]
// CHECK:STDOUT: %Other.decl: type = class_decl @Other [concrete = constants.%Other] {} {}
@@ -143,14 +143,14 @@ fn F() {
// CHECK:STDOUT: }
// CHECK:STDOUT: %Cpp.ref.loc8: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Enum.ref.loc8: type = name_ref Enum, imports.%Enum.decl [concrete = constants.%Enum]
// CHECK:STDOUT: %a.ref.loc8: %Enum = name_ref a, imports.%int_0 [concrete = constants.%int_0.779]
// CHECK:STDOUT: %a.ref.loc8: %Enum = name_ref a, imports.%int_0 [concrete = constants.%int_0.167]
// CHECK:STDOUT: %i16.loc8_37: type = type_literal constants.%i16 [concrete = constants.%i16]
// CHECK:STDOUT: %.loc8_34.1: %i16 = as_compatible %a.ref.loc8 [concrete = constants.%int_0.713]
// CHECK:STDOUT: %.loc8_34.2: %i16 = converted %a.ref.loc8, %.loc8_34.1 [concrete = constants.%int_0.713]
// CHECK:STDOUT: %i16.loc8_17: type = type_literal constants.%i16 [concrete = constants.%i16]
// CHECK:STDOUT: %a: %i16 = value_binding a, %.loc8_34.2
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %b.patt: %pattern_type.9f7 = value_binding_pattern b [concrete]
// CHECK:STDOUT: %b.patt: %pattern_type.361 = value_binding_pattern b [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_42: Core.IntLiteral = int_value 42 [concrete = constants.%int_42.20e]
// CHECK:STDOUT: %i16.loc9: type = type_literal constants.%i16 [concrete = constants.%i16]
@@ -163,22 +163,22 @@ fn F() {
// CHECK:STDOUT: %.loc9_32.2: %i16 = converted %int_42, %.loc9_32.1 [concrete = constants.%int_42.50d]
// CHECK:STDOUT: %Cpp.ref.loc9_43: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Enum.ref.loc9_46: type = name_ref Enum, imports.%Enum.decl [concrete = constants.%Enum]
// CHECK:STDOUT: %.loc9_40.1: %Enum = as_compatible %.loc9_32.2 [concrete = constants.%int_42.7b3]
// CHECK:STDOUT: %.loc9_40.2: %Enum = converted %.loc9_32.2, %.loc9_40.1 [concrete = constants.%int_42.7b3]
// CHECK:STDOUT: %.loc9_40.1: %Enum = as_compatible %.loc9_32.2 [concrete = constants.%int_42.3d1]
// CHECK:STDOUT: %.loc9_40.2: %Enum = converted %.loc9_32.2, %.loc9_40.1 [concrete = constants.%int_42.3d1]
// CHECK:STDOUT: %.loc9_20: type = splice_block %Enum.ref.loc9_20 [concrete = constants.%Enum] {
// CHECK:STDOUT: %Cpp.ref.loc9_17: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Enum.ref.loc9_20: type = name_ref Enum, imports.%Enum.decl [concrete = constants.%Enum]
// CHECK:STDOUT: }
// CHECK:STDOUT: %b: %Enum = value_binding b, %.loc9_40.2
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %c.patt: %pattern_type.da8 = value_binding_pattern c [concrete]
// CHECK:STDOUT: %c.patt: %pattern_type.7cb = value_binding_pattern c [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Cpp.ref.loc10_29: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %a.ref.loc10: %Enum = name_ref a, imports.%int_0 [concrete = constants.%int_0.779]
// CHECK:STDOUT: %a.ref.loc10: %Enum = name_ref a, imports.%int_0 [concrete = constants.%int_0.167]
// CHECK:STDOUT: %Cpp.ref.loc10_38: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Other.ref.loc10_41: type = name_ref Other, imports.%Other.decl [concrete = constants.%Other]
// CHECK:STDOUT: %.loc10_35.1: %Other = as_compatible %a.ref.loc10 [concrete = constants.%int_0.9f3]
// CHECK:STDOUT: %.loc10_35.2: %Other = converted %a.ref.loc10, %.loc10_35.1 [concrete = constants.%int_0.9f3]
// CHECK:STDOUT: %.loc10_35.1: %Other = as_compatible %a.ref.loc10 [concrete = constants.%int_0.10c]
// CHECK:STDOUT: %.loc10_35.2: %Other = converted %a.ref.loc10, %.loc10_35.1 [concrete = constants.%int_0.10c]
// CHECK:STDOUT: %.loc10_20: type = splice_block %Other.ref.loc10_20 [concrete = constants.%Other] {
// CHECK:STDOUT: %Cpp.ref.loc10_17: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Other.ref.loc10_20: type = name_ref Other, imports.%Other.decl [concrete = constants.%Other]
+12 -12
View File
@@ -35,18 +35,18 @@ fn F() {
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
// CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
// CHECK:STDOUT: %Enum: type = class_type @Enum [concrete]
// CHECK:STDOUT: %pattern_type.9f7: type = pattern_type %Enum [concrete]
// CHECK:STDOUT: %pattern_type.361: type = pattern_type %Enum [concrete]
// CHECK:STDOUT: %int_0: %Enum = int_value 0 [concrete]
// CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
// CHECK:STDOUT: %Enum.Op.type: type = fn_type @Enum.Op [concrete]
// CHECK:STDOUT: %Enum.Op: %Enum.Op.type = struct_value () [concrete]
// CHECK:STDOUT: %custom_witness.b8d: <witness> = custom_witness (%Enum.Op), @Copy [concrete]
// CHECK:STDOUT: %Copy.facet.ae7: %Copy.type = facet_value %Enum, (%custom_witness.b8d) [concrete]
// CHECK:STDOUT: %Copy.WithSelf.Op.type.100: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%Copy.facet.ae7) [concrete]
// CHECK:STDOUT: %.e06: type = fn_type_with_self_type %Copy.WithSelf.Op.type.100, %Copy.facet.ae7 [concrete]
// CHECK:STDOUT: %Enum.Op.bound.7be: <bound method> = bound_method %int_0, %Enum.Op [concrete]
// CHECK:STDOUT: %Copy.facet.4ef: %Copy.type = facet_value %Enum, (%custom_witness.b8d) [concrete]
// CHECK:STDOUT: %Copy.WithSelf.Op.type.bb4: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%Copy.facet.4ef) [concrete]
// CHECK:STDOUT: %.a09: type = fn_type_with_self_type %Copy.WithSelf.Op.type.bb4, %Copy.facet.4ef [concrete]
// CHECK:STDOUT: %Enum.Op.bound.c3d: <bound method> = bound_method %int_0, %Enum.Op [concrete]
// CHECK:STDOUT: %int_1: %Enum = int_value 1 [concrete]
// CHECK:STDOUT: %Enum.Op.bound.c35: <bound method> = bound_method %int_1, %Enum.Op [concrete]
// CHECK:STDOUT: %Enum.Op.bound.6f8: <bound method> = bound_method %int_1, %Enum.Op [concrete]
// CHECK:STDOUT: %Destroy.Op.type: type = fn_type @Destroy.Op [concrete]
// CHECK:STDOUT: %Destroy.Op: %Destroy.Op.type = struct_value () [concrete]
// CHECK:STDOUT: }
@@ -68,15 +68,15 @@ fn F() {
// CHECK:STDOUT: fn @F() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %a.patt: %pattern_type.9f7 = ref_binding_pattern a [concrete]
// CHECK:STDOUT: %a.var_patt: %pattern_type.9f7 = var_pattern %a.patt [concrete]
// CHECK:STDOUT: %a.patt: %pattern_type.361 = ref_binding_pattern a [concrete]
// CHECK:STDOUT: %a.var_patt: %pattern_type.361 = var_pattern %a.patt [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %a.var: ref %Enum = var %a.var_patt
// CHECK:STDOUT: %Cpp.ref.loc8_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Enum.ref.loc8_24: type = name_ref Enum, imports.%Enum.decl [concrete = constants.%Enum]
// CHECK:STDOUT: %a.ref.loc8: %Enum = name_ref a, imports.%int_0 [concrete = constants.%int_0]
// CHECK:STDOUT: %impl.elem0.loc8: %.e06 = impl_witness_access constants.%custom_witness.b8d, element0 [concrete = constants.%Enum.Op]
// CHECK:STDOUT: %bound_method.loc8: <bound method> = bound_method %a.ref.loc8, %impl.elem0.loc8 [concrete = constants.%Enum.Op.bound.7be]
// CHECK:STDOUT: %impl.elem0.loc8: %.a09 = impl_witness_access constants.%custom_witness.b8d, element0 [concrete = constants.%Enum.Op]
// CHECK:STDOUT: %bound_method.loc8: <bound method> = bound_method %a.ref.loc8, %impl.elem0.loc8 [concrete = constants.%Enum.Op.bound.c3d]
// CHECK:STDOUT: %Enum.Op.call.loc8: init %Enum = call %bound_method.loc8(%a.ref.loc8) [concrete = constants.%int_0]
// CHECK:STDOUT: assign %a.var, %Enum.Op.call.loc8
// CHECK:STDOUT: %.loc8: type = splice_block %Enum.ref.loc8_13 [concrete = constants.%Enum] {
@@ -88,8 +88,8 @@ fn F() {
// CHECK:STDOUT: %Cpp.ref.loc10: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Enum.ref.loc10: type = name_ref Enum, imports.%Enum.decl [concrete = constants.%Enum]
// CHECK:STDOUT: %b.ref: %Enum = name_ref b, imports.%int_1 [concrete = constants.%int_1]
// CHECK:STDOUT: %impl.elem0.loc10: %.e06 = impl_witness_access constants.%custom_witness.b8d, element0 [concrete = constants.%Enum.Op]
// CHECK:STDOUT: %bound_method.loc10: <bound method> = bound_method %b.ref, %impl.elem0.loc10 [concrete = constants.%Enum.Op.bound.c35]
// CHECK:STDOUT: %impl.elem0.loc10: %.a09 = impl_witness_access constants.%custom_witness.b8d, element0 [concrete = constants.%Enum.Op]
// CHECK:STDOUT: %bound_method.loc10: <bound method> = bound_method %b.ref, %impl.elem0.loc10 [concrete = constants.%Enum.Op.bound.6f8]
// CHECK:STDOUT: %Enum.Op.call.loc10: init %Enum = call %bound_method.loc10(%b.ref) [concrete = constants.%int_1]
// CHECK:STDOUT: assign %a.ref.loc10, %Enum.Op.call.loc10
// CHECK:STDOUT: %Destroy.Op.bound: <bound method> = bound_method %a.var, constants.%Destroy.Op
+20 -20
View File
@@ -55,31 +55,31 @@ fn F() {
// CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
// CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
// CHECK:STDOUT: %Color: type = class_type @Color [concrete]
// CHECK:STDOUT: %pattern_type.625: type = pattern_type %Color [concrete]
// CHECK:STDOUT: %int_0.5a5: %Color = int_value 0 [concrete]
// CHECK:STDOUT: %int_1.a87: %Color = int_value 1 [concrete]
// CHECK:STDOUT: %pattern_type.3ad: type = pattern_type %Color [concrete]
// CHECK:STDOUT: %int_0.dc7: %Color = int_value 0 [concrete]
// CHECK:STDOUT: %int_1.c71: %Color = int_value 1 [concrete]
// CHECK:STDOUT: %Zoo: type = class_type @Zoo [concrete]
// CHECK:STDOUT: %Animal: type = class_type @Animal [concrete]
// CHECK:STDOUT: %pattern_type.531: type = pattern_type %Animal [concrete]
// CHECK:STDOUT: %int_0.30a: %Animal = int_value 0 [concrete]
// CHECK:STDOUT: %int_1.292: %Animal = int_value 1 [concrete]
// CHECK:STDOUT: %pattern_type.e29: type = pattern_type %Animal [concrete]
// CHECK:STDOUT: %int_0.f35: %Animal = int_value 0 [concrete]
// CHECK:STDOUT: %int_1.a89: %Animal = int_value 1 [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
// CHECK:STDOUT: .Color = %Color.decl
// CHECK:STDOUT: .Blue = %int_1.a87
// CHECK:STDOUT: .Blue = %int_1.c71
// CHECK:STDOUT: .Zoo = %Zoo.decl
// CHECK:STDOUT: .Dog = %int_1.292
// CHECK:STDOUT: .Dog = %int_1.a89
// CHECK:STDOUT: import Cpp//...
// CHECK:STDOUT: }
// CHECK:STDOUT: %Color.decl: type = class_decl @Color [concrete = constants.%Color] {} {}
// CHECK:STDOUT: %int_0.5a5: %Color = int_value 0 [concrete = constants.%int_0.5a5]
// CHECK:STDOUT: %int_1.a87: %Color = int_value 1 [concrete = constants.%int_1.a87]
// CHECK:STDOUT: %int_0.dc7: %Color = int_value 0 [concrete = constants.%int_0.dc7]
// CHECK:STDOUT: %int_1.c71: %Color = int_value 1 [concrete = constants.%int_1.c71]
// CHECK:STDOUT: %Zoo.decl: type = class_decl @Zoo [concrete = constants.%Zoo] {} {}
// CHECK:STDOUT: %Animal.decl: type = class_decl @Animal [concrete = constants.%Animal] {} {}
// CHECK:STDOUT: %int_0.30a: %Animal = int_value 0 [concrete = constants.%int_0.30a]
// CHECK:STDOUT: %int_1.292: %Animal = int_value 1 [concrete = constants.%int_1.292]
// CHECK:STDOUT: %int_0.f35: %Animal = int_value 0 [concrete = constants.%int_0.f35]
// CHECK:STDOUT: %int_1.a89: %Animal = int_value 1 [concrete = constants.%int_1.a89]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -89,33 +89,33 @@ fn F() {
// CHECK:STDOUT: fn @F() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %col.patt: %pattern_type.625 = value_binding_pattern col [concrete]
// CHECK:STDOUT: %col.patt: %pattern_type.3ad = value_binding_pattern col [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Cpp.ref.loc18_32: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Color.ref.loc18_35: type = name_ref Color, imports.%Color.decl [concrete = constants.%Color]
// CHECK:STDOUT: %Red.ref: %Color = name_ref Red, imports.%int_0.5a5 [concrete = constants.%int_0.5a5]
// CHECK:STDOUT: %Red.ref: %Color = name_ref Red, imports.%int_0.dc7 [concrete = constants.%int_0.dc7]
// CHECK:STDOUT: %.loc18: type = splice_block %Color.ref.loc18_23 [concrete = constants.%Color] {
// CHECK:STDOUT: %Cpp.ref.loc18_20: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Color.ref.loc18_23: type = name_ref Color, imports.%Color.decl [concrete = constants.%Color]
// CHECK:STDOUT: }
// CHECK:STDOUT: %col: %Color = value_binding col, %Red.ref
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %colb.patt: %pattern_type.625 = value_binding_pattern colb [concrete]
// CHECK:STDOUT: %colb.patt: %pattern_type.3ad = value_binding_pattern colb [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Cpp.ref.loc19_33: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Blue.ref: %Color = name_ref Blue, imports.%int_1.a87 [concrete = constants.%int_1.a87]
// CHECK:STDOUT: %Blue.ref: %Color = name_ref Blue, imports.%int_1.c71 [concrete = constants.%int_1.c71]
// CHECK:STDOUT: %.loc19: type = splice_block %Color.ref.loc19 [concrete = constants.%Color] {
// CHECK:STDOUT: %Cpp.ref.loc19_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Color.ref.loc19: type = name_ref Color, imports.%Color.decl [concrete = constants.%Color]
// CHECK:STDOUT: }
// CHECK:STDOUT: %colb: %Color = value_binding colb, %Blue.ref
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %pet.patt: %pattern_type.531 = value_binding_pattern pet [concrete]
// CHECK:STDOUT: %pet.patt: %pattern_type.e29 = value_binding_pattern pet [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Cpp.ref.loc20_37: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Zoo.ref.loc20_40: type = name_ref Zoo, imports.%Zoo.decl [concrete = constants.%Zoo]
// CHECK:STDOUT: %Animal.ref.loc20_44: type = name_ref Animal, imports.%Animal.decl [concrete = constants.%Animal]
// CHECK:STDOUT: %Cat.ref: %Animal = name_ref Cat, imports.%int_0.30a [concrete = constants.%int_0.30a]
// CHECK:STDOUT: %Cat.ref: %Animal = name_ref Cat, imports.%int_0.f35 [concrete = constants.%int_0.f35]
// CHECK:STDOUT: %.loc20: type = splice_block %Animal.ref.loc20_27 [concrete = constants.%Animal] {
// CHECK:STDOUT: %Cpp.ref.loc20_20: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Zoo.ref.loc20_23: type = name_ref Zoo, imports.%Zoo.decl [concrete = constants.%Zoo]
@@ -123,10 +123,10 @@ fn F() {
// CHECK:STDOUT: }
// CHECK:STDOUT: %pet: %Animal = value_binding pet, %Cat.ref
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %pet2.patt: %pattern_type.531 = value_binding_pattern pet2 [concrete]
// CHECK:STDOUT: %pet2.patt: %pattern_type.e29 = value_binding_pattern pet2 [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Cpp.ref.loc21_38: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Dog.ref: %Animal = name_ref Dog, imports.%int_1.292 [concrete = constants.%int_1.292]
// CHECK:STDOUT: %Dog.ref: %Animal = name_ref Dog, imports.%int_1.a89 [concrete = constants.%int_1.a89]
// CHECK:STDOUT: %.loc21: type = splice_block %Animal.ref.loc21 [concrete = constants.%Animal] {
// CHECK:STDOUT: %Cpp.ref.loc21_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Zoo.ref.loc21: type = name_ref Zoo, imports.%Zoo.decl [concrete = constants.%Zoo]