Lower CppOverloadSetValue (#6101)

Following up on comments from
[#5891](https://github.com/carbon-language/carbon-lang/pull/5891) ([
1](https://github.com/carbon-language/carbon-lang/pull/5891#discussion_r2317244981),
[2](https://github.com/carbon-language/carbon-lang/pull/5891#discussion_r2317266756)).

Lowering `CppOverloadSetValue` as an empty struct value, using
`context.GetLiteralAsValue()`. Also changed its constant kind to
`InstConstantKind::Always`.

Part of https://github.com/carbon-language/carbon-lang/issues/5915
This commit is contained in:
Ivana Ivanovska
2025-10-01 16:25:05 +00:00
committed by GitHub
parent 4a6376cf59
commit a24598f069
40 changed files with 838 additions and 698 deletions
@@ -39,7 +39,7 @@ fn F() {
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
// CHECK:STDOUT: %X: type = class_type @X [concrete]
// CHECK:STDOUT: %.034: type = cpp_overload_set_type @X.f [concrete]
// CHECK:STDOUT: %empty_struct: %.034 = struct_value () [concrete]
// CHECK:STDOUT: %.a8d: %.034 = cpp_overload_set_value @X.f [concrete]
// CHECK:STDOUT: %int_42.20e: Core.IntLiteral = int_value 42 [concrete]
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
@@ -67,7 +67,7 @@ fn F() {
// CHECK:STDOUT: import Cpp//...
// CHECK:STDOUT: }
// CHECK:STDOUT: %X.decl: type = class_decl @X [concrete = constants.%X] {} {}
// CHECK:STDOUT: %.a8d: %.034 = cpp_overload_set_value @X.f [concrete = constants.%empty_struct]
// CHECK:STDOUT: %.a8d: %.034 = cpp_overload_set_value @X.f [concrete = constants.%.a8d]
// CHECK:STDOUT: %X.f.decl: %X.f.type = fn_decl @X.f [concrete = constants.%X.f] {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: } {
@@ -81,7 +81,7 @@ fn F() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Y.ref: type = name_ref Y, imports.%X.decl [concrete = constants.%X]
// CHECK:STDOUT: %f.ref: %.034 = name_ref f, imports.%.a8d [concrete = constants.%empty_struct]
// CHECK:STDOUT: %f.ref: %.034 = name_ref f, imports.%.a8d [concrete = constants.%.a8d]
// CHECK:STDOUT: %int_42: Core.IntLiteral = int_value 42 [concrete = constants.%int_42.20e]
// CHECK:STDOUT: %impl.elem0: %.1df = impl_witness_access constants.%ImplicitAs.impl_witness.204, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0f0]
// CHECK:STDOUT: %bound_method.loc8_11.1: <bound method> = bound_method %int_42, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]