Add range flag settings to class files (#5556)

Where `--no-dump-sem-ir` is used, change to `--dump-sem-ir-ranges=only`.
Otherwise, add `--dump-sem-ir-ranges=if-present` with a TODO to change
to `only`.

Note, SemIR is affected just because the extra comments change line
numbers in files where splits aren't in use.
This commit is contained in:
Jon Ross-Perkins
2025-05-29 18:32:57 +00:00
committed by GitHub
parent 6318987343
commit 3fb4d9a468
123 changed files with 2111 additions and 1754 deletions
+39 -36
View File
@@ -2,6 +2,9 @@
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
// EXTRA-ARGS: --dump-sem-ir-ranges=if-present
//
// AUTOUPDATE
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/basic.carbon
@@ -90,16 +93,16 @@ fn Run() -> i32 {
// CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
// CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param1 [concrete]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int_32.loc21_23: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32.loc21_23: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: %n.param.loc21: %i32 = value_param call_param0
// CHECK:STDOUT: %.loc21: type = splice_block %i32.loc21_15 [concrete = constants.%i32] {
// CHECK:STDOUT: %int_32.loc21_15: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32.loc21_15: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: %int_32.loc24_23: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32.loc24_23: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: %n.param.loc24: %i32 = value_param call_param0
// CHECK:STDOUT: %.loc24: type = splice_block %i32.loc24_15 [concrete = constants.%i32] {
// CHECK:STDOUT: %int_32.loc24_15: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32.loc24_15: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: }
// CHECK:STDOUT: %n.loc21: %i32 = bind_name n, %n.param.loc21
// CHECK:STDOUT: %return.param.loc21: ref %i32 = out_param call_param1
// CHECK:STDOUT: %return.loc21: ref %i32 = return_slot %return.param.loc21
// CHECK:STDOUT: %n.loc24: %i32 = bind_name n, %n.param.loc24
// CHECK:STDOUT: %return.param.loc24: ref %i32 = out_param call_param1
// CHECK:STDOUT: %return.loc24: ref %i32 = return_slot %return.param.loc24
// CHECK:STDOUT: }
// CHECK:STDOUT: %Run.decl: %Run.type = fn_decl @Run [concrete = constants.%Run] {
// CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
@@ -121,12 +124,12 @@ fn Run() -> i32 {
// CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
// CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param1 [concrete]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int_32.loc12_19: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32.loc12_19: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: %int_32.loc15_19: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32.loc15_19: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: %n.param: %i32 = value_param call_param0
// CHECK:STDOUT: %.loc12: type = splice_block %i32.loc12_11 [concrete = constants.%i32] {
// CHECK:STDOUT: %int_32.loc12_11: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32.loc12_11: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: %.loc15: type = splice_block %i32.loc15_11 [concrete = constants.%i32] {
// CHECK:STDOUT: %int_32.loc15_11: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32.loc15_11: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: }
// CHECK:STDOUT: %n: %i32 = bind_name n, %n.param
// CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1
@@ -138,20 +141,20 @@ fn Run() -> i32 {
// CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
// CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param1 [concrete]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int_32.loc16_19: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32.loc16_19: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: %n.param.loc16: %i32 = value_param call_param0
// CHECK:STDOUT: %.loc16: type = splice_block %i32.loc16_11 [concrete = constants.%i32] {
// CHECK:STDOUT: %int_32.loc16_11: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32.loc16_11: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: %int_32.loc19_19: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32.loc19_19: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: %n.param.loc19: %i32 = value_param call_param0
// CHECK:STDOUT: %.loc19: type = splice_block %i32.loc19_11 [concrete = constants.%i32] {
// CHECK:STDOUT: %int_32.loc19_11: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32.loc19_11: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: }
// CHECK:STDOUT: %n.loc16: %i32 = bind_name n, %n.param.loc16
// CHECK:STDOUT: %return.param.loc16: ref %i32 = out_param call_param1
// CHECK:STDOUT: %return.loc16: ref %i32 = return_slot %return.param.loc16
// CHECK:STDOUT: %n.loc19: %i32 = bind_name n, %n.param.loc19
// CHECK:STDOUT: %return.param.loc19: ref %i32 = out_param call_param1
// CHECK:STDOUT: %return.loc19: ref %i32 = return_slot %return.param.loc19
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
// CHECK:STDOUT: %.loc18: %Class.elem = field_decl k, element0 [concrete]
// CHECK:STDOUT: %.loc21: %Class.elem = field_decl k, element0 [concrete]
// CHECK:STDOUT: %struct_type.k: type = struct_type {.k: %i32} [concrete = constants.%struct_type.k]
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.k [concrete = constants.%complete_type.954]
// CHECK:STDOUT: complete_type_witness = %complete_type
@@ -160,7 +163,7 @@ fn Run() -> i32 {
// CHECK:STDOUT: .Self = constants.%Class
// CHECK:STDOUT: .F = %F.decl
// CHECK:STDOUT: .G = %G.decl
// CHECK:STDOUT: .k = %.loc18
// CHECK:STDOUT: .k = %.loc21
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F(%n.param: %i32) -> %i32 {
@@ -169,9 +172,9 @@ fn Run() -> i32 {
// CHECK:STDOUT: return %n.ref
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @G(%n.param.loc21: %i32) -> %i32 {
// CHECK:STDOUT: fn @G(%n.param.loc24: %i32) -> %i32 {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %n.ref: %i32 = name_ref n, %n.loc21
// CHECK:STDOUT: %n.ref: %i32 = name_ref n, %n.loc24
// CHECK:STDOUT: return %n.ref
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -181,15 +184,15 @@ fn Run() -> i32 {
// CHECK:STDOUT: %F.ref: %F.type = name_ref F, @Class.%F.decl [concrete = constants.%F]
// CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1]
// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
// CHECK:STDOUT: %bound_method.loc26_18.1: <bound method> = bound_method %int_4, %impl.elem0 [concrete = constants.%Convert.bound]
// CHECK:STDOUT: %bound_method.loc29_18.1: <bound method> = bound_method %int_4, %impl.elem0 [concrete = constants.%Convert.bound]
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc26_18.2: <bound method> = bound_method %int_4, %specific_fn [concrete = constants.%bound_method]
// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc26_18.2(%int_4) [concrete = constants.%int_4.940]
// CHECK:STDOUT: %.loc26_18.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_4.940]
// CHECK:STDOUT: %.loc26_18.2: %i32 = converted %int_4, %.loc26_18.1 [concrete = constants.%int_4.940]
// CHECK:STDOUT: %F.call: init %i32 = call %F.ref(%.loc26_18.2)
// CHECK:STDOUT: %.loc26_20.1: %i32 = value_of_initializer %F.call
// CHECK:STDOUT: %.loc26_20.2: %i32 = converted %F.call, %.loc26_20.1
// CHECK:STDOUT: return %.loc26_20.2
// CHECK:STDOUT: %bound_method.loc29_18.2: <bound method> = bound_method %int_4, %specific_fn [concrete = constants.%bound_method]
// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc29_18.2(%int_4) [concrete = constants.%int_4.940]
// CHECK:STDOUT: %.loc29_18.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_4.940]
// CHECK:STDOUT: %.loc29_18.2: %i32 = converted %int_4, %.loc29_18.1 [concrete = constants.%int_4.940]
// CHECK:STDOUT: %F.call: init %i32 = call %F.ref(%.loc29_18.2)
// CHECK:STDOUT: %.loc29_20.1: %i32 = value_of_initializer %F.call
// CHECK:STDOUT: %.loc29_20.2: %i32 = converted %F.call, %.loc29_20.1
// CHECK:STDOUT: return %.loc29_20.2
// CHECK:STDOUT: }
// CHECK:STDOUT: