// Part of the Carbon Language project, under the Apache License v2.0 with LLVM // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/declaration/no_prelude/export_name.carbon // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/no_prelude/export_name.carbon // ============================================================================ // Setup files // ============================================================================ // --- base.carbon library "base"; fn F(); // --- export.carbon library "export"; import library "base"; export F; // ============================================================================ // Test files // ============================================================================ // --- use_export.carbon library "use_export"; import library "export"; var f: () = F(); // CHECK:STDOUT: --- base.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(); // CHECK:STDOUT: // CHECK:STDOUT: --- export.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .F = %F // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref: %F.type = import_ref ir1, inst+1, loaded [template = constants.%F] // CHECK:STDOUT: %F: %F.type = export F, %import_ref [template = constants.%F] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(); // CHECK:STDOUT: // CHECK:STDOUT: --- use_export.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type () [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .F = %import_ref // CHECK:STDOUT: .f = %f // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref: %F.type = import_ref ir1, inst+6, loaded [template = constants.%F] // CHECK:STDOUT: %.loc6_9.1: %.1 = tuple_literal () // CHECK:STDOUT: %.loc6_9.2: type = converted %.loc6_9.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %f.var: ref %.1 = var f // CHECK:STDOUT: %f: ref %.1 = bind_name f, %f.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%import_ref [template = constants.%F] // CHECK:STDOUT: %F.call: init %.1 = call %F.ref() // CHECK:STDOUT: assign file.%f.var, %F.call // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: