mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-28 16:24:53 +01:00
Fixes link failures when referencing a symbol involving a fingerprint from a different package. Previously we included the `Namespace`'s `import_id` as part of its fingerprint, which caused local and imported namespaces to get different fingerprints. We now store the `import_id` on the `NameScope` instead of on the `Namespace` inst to avoid this problem. Also, when we reach a package-level `NameScopeId`, consistently fingerprint it as a (package name, library name) pair. Previously the fingerprinting depended on whether it was imported or not, as an imported `NameScopeId` had a parent scope (the current package). We need to include the library name here so that private entities with the same name in different libraries have different fingerprints.
473 lines
28 KiB
Plaintext
473 lines
28 KiB
Plaintext
// 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
|
|
//
|
|
// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/int.carbon
|
|
//
|
|
// AUTOUPDATE
|
|
// TIP: To test this file alone, run:
|
|
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/impl/import_thunk.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/impl/import_thunk.carbon
|
|
|
|
// --- thunk.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
class A { var a: i32; }
|
|
class B { var b: i32; }
|
|
class C { var c: i32; }
|
|
|
|
impl A as Core.ImplicitAs(B) {
|
|
fn Convert[self: A]() -> B { return {.b = self.a}; }
|
|
}
|
|
impl B as Core.ImplicitAs(C) {
|
|
fn Convert[self: B]() -> C { return {.c = self.b}; }
|
|
}
|
|
|
|
interface I {
|
|
fn F(a: A) -> C;
|
|
}
|
|
|
|
impl () as I {
|
|
fn F(b: B) -> B { return {.b = b.b}; }
|
|
}
|
|
|
|
// --- call_thunk.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import library "thunk";
|
|
|
|
fn Test(a: A) -> C {
|
|
return ().(I.F)(a);
|
|
}
|
|
|
|
// --- thunk_for_imported_interface.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import library "thunk";
|
|
|
|
class X {}
|
|
|
|
impl X as I {
|
|
fn F(b: B) -> B { return {.b = b.b}; }
|
|
}
|
|
|
|
// --- call_thunk_for_imported_interface.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import library "thunk";
|
|
import library "thunk_for_imported_interface";
|
|
|
|
fn Test(a: A) -> C {
|
|
return X.(I.F)(a);
|
|
}
|
|
|
|
// CHECK:STDOUT: ; ModuleID = 'thunk.carbon'
|
|
// CHECK:STDOUT: source_filename = "thunk.carbon"
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define void @"_CConvert.A.Main:ImplicitAs.8b79c6c1932e58f6.Core"(ptr sret({ i32 }) %return, ptr %self) #0 !dbg !4 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: %.loc9_49.1.a = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !10
|
|
// CHECK:STDOUT: %.loc9_49.2 = load i32, ptr %.loc9_49.1.a, align 4, !dbg !10
|
|
// CHECK:STDOUT: %.loc9_51.2.b = getelementptr inbounds nuw { i32 }, ptr %return, i32 0, i32 0, !dbg !11
|
|
// CHECK:STDOUT: store i32 %.loc9_49.2, ptr %.loc9_51.2.b, align 4, !dbg !11
|
|
// CHECK:STDOUT: ret void, !dbg !12
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define void @"_CConvert.B.Main:ImplicitAs.cc918b9f1e9f377a.Core"(ptr sret({ i32 }) %return, ptr %self) #0 !dbg !13 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: %.loc12_49.1.b = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !16
|
|
// CHECK:STDOUT: %.loc12_49.2 = load i32, ptr %.loc12_49.1.b, align 4, !dbg !16
|
|
// CHECK:STDOUT: %.loc12_51.2.c = getelementptr inbounds nuw { i32 }, ptr %return, i32 0, i32 0, !dbg !17
|
|
// CHECK:STDOUT: store i32 %.loc12_49.2, ptr %.loc12_51.2.c, align 4, !dbg !17
|
|
// CHECK:STDOUT: ret void, !dbg !18
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define void @"_CF.61ea2aba74ab3bf1:I.Main"(ptr sret({ i32 }) %return, ptr %b) #0 !dbg !19 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: %.loc20_35.1.b = getelementptr inbounds nuw { i32 }, ptr %b, i32 0, i32 0, !dbg !22
|
|
// CHECK:STDOUT: %.loc20_35.2 = load i32, ptr %.loc20_35.1.b, align 4, !dbg !22
|
|
// CHECK:STDOUT: %.loc20_37.2.b = getelementptr inbounds nuw { i32 }, ptr %return, i32 0, i32 0, !dbg !23
|
|
// CHECK:STDOUT: store i32 %.loc20_35.2, ptr %.loc20_37.2.b, align 4, !dbg !23
|
|
// CHECK:STDOUT: ret void, !dbg !24
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: alwaysinline nounwind
|
|
// CHECK:STDOUT: define void @"_CF:thunk:I.01f5c37cad34e90b.Main:61ea2aba74ab3bf1:I.Main"(ptr sret({ i32 }) %return, ptr %a) #1 !dbg !25 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: %.loc20_19.1.temp = alloca { i32 }, align 8, !dbg !28
|
|
// CHECK:STDOUT: %.loc16_9.1.temp = alloca { i32 }, align 8, !dbg !29
|
|
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc20_19.1.temp), !dbg !28
|
|
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc16_9.1.temp), !dbg !29
|
|
// CHECK:STDOUT: call void @"_CConvert.A.Main:ImplicitAs.8b79c6c1932e58f6.Core"(ptr %.loc16_9.1.temp, ptr %a), !dbg !29
|
|
// CHECK:STDOUT: call void @"_CF.61ea2aba74ab3bf1:I.Main"(ptr %.loc20_19.1.temp, ptr %.loc16_9.1.temp), !dbg !28
|
|
// CHECK:STDOUT: call void @"_CConvert.B.Main:ImplicitAs.cc918b9f1e9f377a.Core"(ptr %return, ptr %.loc20_19.1.temp), !dbg !28
|
|
// CHECK:STDOUT: call void @"_COp.c989b489e17b3e13:core.Destroy.Core"(ptr %.loc20_19.1.temp), !dbg !28
|
|
// CHECK:STDOUT: call void @"_COp.c989b489e17b3e13:core.Destroy.Core"(ptr %.loc16_9.1.temp), !dbg !29
|
|
// CHECK:STDOUT: ret void, !dbg !28
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define weak_odr void @"_COp.94e3ca86614aba5d:core.Destroy.Core"(ptr %self) #0 !dbg !30 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: ret void, !dbg !36
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define weak_odr void @"_COp.a9ac47a486d88918:core.Destroy.Core"(ptr %self) #0 !dbg !37 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: ret void, !dbg !42
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define weak_odr void @"_COp.c989b489e17b3e13:core.Destroy.Core"(ptr %self) #0 !dbg !43 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: ret void, !dbg !46
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
|
|
// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #2
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; uselistorder directives
|
|
// CHECK:STDOUT: uselistorder ptr @"_COp.c989b489e17b3e13:core.Destroy.Core", { 1, 0 }
|
|
// CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: attributes #0 = { nounwind }
|
|
// CHECK:STDOUT: attributes #1 = { alwaysinline nounwind }
|
|
// CHECK:STDOUT: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
|
|
// CHECK:STDOUT: !llvm.dbg.cu = !{!2}
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
|
|
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
|
|
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
|
|
// CHECK:STDOUT: !3 = !DIFile(filename: "thunk.carbon", directory: "")
|
|
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.A.Main:ImplicitAs.8b79c6c1932e58f6.Core", scope: null, file: !3, line: 9, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !8)
|
|
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
|
|
// CHECK:STDOUT: !6 = !{!7, !7}
|
|
// CHECK:STDOUT: !7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)
|
|
// CHECK:STDOUT: !8 = !{!9}
|
|
// CHECK:STDOUT: !9 = !DILocalVariable(arg: 1, scope: !4, type: !7)
|
|
// CHECK:STDOUT: !10 = !DILocation(line: 9, column: 45, scope: !4)
|
|
// CHECK:STDOUT: !11 = !DILocation(line: 9, column: 39, scope: !4)
|
|
// CHECK:STDOUT: !12 = !DILocation(line: 9, column: 32, scope: !4)
|
|
// CHECK:STDOUT: !13 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.B.Main:ImplicitAs.cc918b9f1e9f377a.Core", scope: null, file: !3, line: 12, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !14)
|
|
// CHECK:STDOUT: !14 = !{!15}
|
|
// CHECK:STDOUT: !15 = !DILocalVariable(arg: 1, scope: !13, type: !7)
|
|
// CHECK:STDOUT: !16 = !DILocation(line: 12, column: 45, scope: !13)
|
|
// CHECK:STDOUT: !17 = !DILocation(line: 12, column: 39, scope: !13)
|
|
// CHECK:STDOUT: !18 = !DILocation(line: 12, column: 32, scope: !13)
|
|
// CHECK:STDOUT: !19 = distinct !DISubprogram(name: "F", linkageName: "_CF.61ea2aba74ab3bf1:I.Main", scope: null, file: !3, line: 20, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !20)
|
|
// CHECK:STDOUT: !20 = !{!21}
|
|
// CHECK:STDOUT: !21 = !DILocalVariable(arg: 1, scope: !19, type: !7)
|
|
// CHECK:STDOUT: !22 = !DILocation(line: 20, column: 34, scope: !19)
|
|
// CHECK:STDOUT: !23 = !DILocation(line: 20, column: 28, scope: !19)
|
|
// CHECK:STDOUT: !24 = !DILocation(line: 20, column: 21, scope: !19)
|
|
// CHECK:STDOUT: !25 = distinct !DISubprogram(name: "F", linkageName: "_CF:thunk:I.01f5c37cad34e90b.Main:61ea2aba74ab3bf1:I.Main", scope: null, file: !3, line: 20, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !26)
|
|
// CHECK:STDOUT: !26 = !{!27}
|
|
// CHECK:STDOUT: !27 = !DILocalVariable(arg: 1, scope: !25, type: !7)
|
|
// CHECK:STDOUT: !28 = !DILocation(line: 20, column: 3, scope: !25)
|
|
// CHECK:STDOUT: !29 = !DILocation(line: 16, column: 8, scope: !25)
|
|
// CHECK:STDOUT: !30 = distinct !DISubprogram(name: "Op", linkageName: "_COp.94e3ca86614aba5d:core.Destroy.Core", scope: null, file: !3, line: 20, type: !31, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !34)
|
|
// CHECK:STDOUT: !31 = !DISubroutineType(types: !32)
|
|
// CHECK:STDOUT: !32 = !{null, !33}
|
|
// CHECK:STDOUT: !33 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
|
|
// CHECK:STDOUT: !34 = !{!35}
|
|
// CHECK:STDOUT: !35 = !DILocalVariable(arg: 1, scope: !30, type: !33)
|
|
// CHECK:STDOUT: !36 = !DILocation(line: 20, column: 3, scope: !30)
|
|
// CHECK:STDOUT: !37 = distinct !DISubprogram(name: "Op", linkageName: "_COp.a9ac47a486d88918:core.Destroy.Core", scope: null, file: !3, line: 20, type: !38, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !40)
|
|
// CHECK:STDOUT: !38 = !DISubroutineType(types: !39)
|
|
// CHECK:STDOUT: !39 = !{null, !7}
|
|
// CHECK:STDOUT: !40 = !{!41}
|
|
// CHECK:STDOUT: !41 = !DILocalVariable(arg: 1, scope: !37, type: !7)
|
|
// CHECK:STDOUT: !42 = !DILocation(line: 20, column: 3, scope: !37)
|
|
// CHECK:STDOUT: !43 = distinct !DISubprogram(name: "Op", linkageName: "_COp.c989b489e17b3e13:core.Destroy.Core", scope: null, file: !3, line: 20, type: !38, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !44)
|
|
// CHECK:STDOUT: !44 = !{!45}
|
|
// CHECK:STDOUT: !45 = !DILocalVariable(arg: 1, scope: !43, type: !7)
|
|
// CHECK:STDOUT: !46 = !DILocation(line: 20, column: 3, scope: !43)
|
|
// CHECK:STDOUT: ; ModuleID = 'call_thunk.carbon'
|
|
// CHECK:STDOUT: source_filename = "call_thunk.carbon"
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define void @_CTest.Main(ptr sret({ i32 }) %return, ptr %a) #0 !dbg !4 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: %.loc7_20.1.temp = alloca { i32 }, align 8, !dbg !10
|
|
// CHECK:STDOUT: %.loc7_20.2.temp = alloca { i32 }, align 8, !dbg !10
|
|
// CHECK:STDOUT: %.loc7_19.1.temp = alloca { i32 }, align 8, !dbg !11
|
|
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc7_20.1.temp), !dbg !10
|
|
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc7_20.2.temp), !dbg !10
|
|
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc7_19.1.temp), !dbg !11
|
|
// CHECK:STDOUT: call void @"_CConvert.A.Main:ImplicitAs.dad78774611a629b.Core"(ptr %.loc7_19.1.temp, ptr %a), !dbg !11
|
|
// CHECK:STDOUT: call void @"_CF.61ea2aba74ab3bf1:I.Main"(ptr %.loc7_20.2.temp, ptr %.loc7_19.1.temp), !dbg !10
|
|
// CHECK:STDOUT: call void @"_CConvert.B.Main:ImplicitAs.b72e1adbdacbf3b5.Core"(ptr %return, ptr %.loc7_20.2.temp), !dbg !12
|
|
// CHECK:STDOUT: call void @"_COp.b288c1296e5779ce:core.Destroy.Core"(ptr %.loc7_20.2.temp), !dbg !10
|
|
// CHECK:STDOUT: call void @"_COp.b288c1296e5779ce:core.Destroy.Core"(ptr %.loc7_19.1.temp), !dbg !11
|
|
// CHECK:STDOUT: ret void, !dbg !12
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: declare void @"_CF:thunk:I.c2653948a81b9903.Main:61ea2aba74ab3bf1:I.Main"(ptr sret({ i32 }), ptr)
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: declare void @"_CF.61ea2aba74ab3bf1:I.Main"(ptr sret({ i32 }), ptr)
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: declare void @"_CConvert.A.Main:ImplicitAs.dad78774611a629b.Core"(ptr sret({ i32 }), ptr)
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: declare void @"_CConvert.B.Main:ImplicitAs.b72e1adbdacbf3b5.Core"(ptr sret({ i32 }), ptr)
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define weak_odr void @"_COp.77ddf68e618a51fe:core.Destroy.Core"(ptr %self) #0 !dbg !13 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: ret void, !dbg !19
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define weak_odr void @"_COp.88c648e6851ef5ad:core.Destroy.Core"(ptr %self) #0 !dbg !20 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: ret void, !dbg !25
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define weak_odr void @"_COp.b288c1296e5779ce:core.Destroy.Core"(ptr %self) #0 !dbg !26 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: ret void, !dbg !29
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
|
|
// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; uselistorder directives
|
|
// CHECK:STDOUT: uselistorder ptr @"_COp.b288c1296e5779ce:core.Destroy.Core", { 1, 0 }
|
|
// CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 2, 1, 0 }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: attributes #0 = { nounwind }
|
|
// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
|
|
// CHECK:STDOUT: !llvm.dbg.cu = !{!2}
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
|
|
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
|
|
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
|
|
// CHECK:STDOUT: !3 = !DIFile(filename: "call_thunk.carbon", directory: "")
|
|
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Test", linkageName: "_CTest.Main", scope: null, file: !3, line: 6, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !8)
|
|
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
|
|
// CHECK:STDOUT: !6 = !{!7, !7}
|
|
// CHECK:STDOUT: !7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)
|
|
// CHECK:STDOUT: !8 = !{!9}
|
|
// CHECK:STDOUT: !9 = !DILocalVariable(arg: 1, scope: !4, type: !7)
|
|
// CHECK:STDOUT: !10 = !DILocation(line: 7, column: 10, scope: !4)
|
|
// CHECK:STDOUT: !11 = !DILocation(line: 7, column: 19, scope: !4)
|
|
// CHECK:STDOUT: !12 = !DILocation(line: 7, column: 3, scope: !4)
|
|
// CHECK:STDOUT: !13 = distinct !DISubprogram(name: "Op", linkageName: "_COp.77ddf68e618a51fe:core.Destroy.Core", scope: null, file: !3, line: 7, type: !14, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !17)
|
|
// CHECK:STDOUT: !14 = !DISubroutineType(types: !15)
|
|
// CHECK:STDOUT: !15 = !{null, !16}
|
|
// CHECK:STDOUT: !16 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
|
|
// CHECK:STDOUT: !17 = !{!18}
|
|
// CHECK:STDOUT: !18 = !DILocalVariable(arg: 1, scope: !13, type: !16)
|
|
// CHECK:STDOUT: !19 = !DILocation(line: 7, column: 10, scope: !13)
|
|
// CHECK:STDOUT: !20 = distinct !DISubprogram(name: "Op", linkageName: "_COp.88c648e6851ef5ad:core.Destroy.Core", scope: null, file: !3, line: 7, type: !21, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !23)
|
|
// CHECK:STDOUT: !21 = !DISubroutineType(types: !22)
|
|
// CHECK:STDOUT: !22 = !{null, !7}
|
|
// CHECK:STDOUT: !23 = !{!24}
|
|
// CHECK:STDOUT: !24 = !DILocalVariable(arg: 1, scope: !20, type: !7)
|
|
// CHECK:STDOUT: !25 = !DILocation(line: 7, column: 10, scope: !20)
|
|
// CHECK:STDOUT: !26 = distinct !DISubprogram(name: "Op", linkageName: "_COp.b288c1296e5779ce:core.Destroy.Core", scope: null, file: !3, line: 7, type: !21, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !27)
|
|
// CHECK:STDOUT: !27 = !{!28}
|
|
// CHECK:STDOUT: !28 = !DILocalVariable(arg: 1, scope: !26, type: !7)
|
|
// CHECK:STDOUT: !29 = !DILocation(line: 7, column: 10, scope: !26)
|
|
// CHECK:STDOUT: ; ModuleID = 'thunk_for_imported_interface.carbon'
|
|
// CHECK:STDOUT: source_filename = "thunk_for_imported_interface.carbon"
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define void @"_CF.X.Main:I.Main"(ptr sret({ i32 }) %return, ptr %b) #0 !dbg !4 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: %.loc9_35.1.b = getelementptr inbounds nuw { i32 }, ptr %b, i32 0, i32 0, !dbg !10
|
|
// CHECK:STDOUT: %.loc9_35.2 = load i32, ptr %.loc9_35.1.b, align 4, !dbg !10
|
|
// CHECK:STDOUT: %.loc9_37.2.b = getelementptr inbounds nuw { i32 }, ptr %return, i32 0, i32 0, !dbg !11
|
|
// CHECK:STDOUT: store i32 %.loc9_35.2, ptr %.loc9_37.2.b, align 4, !dbg !11
|
|
// CHECK:STDOUT: ret void, !dbg !12
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: alwaysinline nounwind
|
|
// CHECK:STDOUT: define void @"_CF:thunk:I.5df87795ec73cda9.Main:X.Main:I.Main"(ptr sret({ i32 }) %return, ptr %a) #1 !dbg !13 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: %.loc9_19.1.temp = alloca { i32 }, align 8, !dbg !16
|
|
// CHECK:STDOUT: %.2.temp = alloca { i32 }, align 8
|
|
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc9_19.1.temp), !dbg !16
|
|
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.2.temp)
|
|
// CHECK:STDOUT: call void @"_CConvert.A.Main:ImplicitAs.0b3b8a3403fe0e1d.Core"(ptr %.2.temp, ptr %a), !dbg !17
|
|
// CHECK:STDOUT: call void @"_CF.X.Main:I.Main"(ptr %.loc9_19.1.temp, ptr %.2.temp), !dbg !16
|
|
// CHECK:STDOUT: call void @"_CConvert.B.Main:ImplicitAs.0e712e3032641f29.Core"(ptr %return, ptr %.loc9_19.1.temp), !dbg !16
|
|
// CHECK:STDOUT: call void @"_COp.4d053df5d5bd57ed:core.Destroy.Core"(ptr %.loc9_19.1.temp), !dbg !16
|
|
// CHECK:STDOUT: call void @"_COp.4d053df5d5bd57ed:core.Destroy.Core"(ptr %.2.temp), !dbg !17
|
|
// CHECK:STDOUT: ret void, !dbg !16
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: declare void @"_CConvert.A.Main:ImplicitAs.0b3b8a3403fe0e1d.Core"(ptr sret({ i32 }), ptr)
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: declare void @"_CConvert.B.Main:ImplicitAs.0e712e3032641f29.Core"(ptr sret({ i32 }), ptr)
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define weak_odr void @"_COp.77ddf68e618a51fe:core.Destroy.Core"(ptr %self) #0 !dbg !18 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: ret void, !dbg !24
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define weak_odr void @"_COp.88c648e6851ef5ad:core.Destroy.Core"(ptr %self) #0 !dbg !25 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: ret void, !dbg !30
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define weak_odr void @"_COp.4d053df5d5bd57ed:core.Destroy.Core"(ptr %self) #0 !dbg !31 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: ret void, !dbg !34
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
|
|
// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #2
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; uselistorder directives
|
|
// CHECK:STDOUT: uselistorder ptr @"_COp.4d053df5d5bd57ed:core.Destroy.Core", { 1, 0 }
|
|
// CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: attributes #0 = { nounwind }
|
|
// CHECK:STDOUT: attributes #1 = { alwaysinline nounwind }
|
|
// CHECK:STDOUT: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
|
|
// CHECK:STDOUT: !llvm.dbg.cu = !{!2}
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
|
|
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
|
|
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
|
|
// CHECK:STDOUT: !3 = !DIFile(filename: "thunk_for_imported_interface.carbon", directory: "")
|
|
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", linkageName: "_CF.X.Main:I.Main", scope: null, file: !3, line: 9, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !8)
|
|
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
|
|
// CHECK:STDOUT: !6 = !{!7, !7}
|
|
// CHECK:STDOUT: !7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)
|
|
// CHECK:STDOUT: !8 = !{!9}
|
|
// CHECK:STDOUT: !9 = !DILocalVariable(arg: 1, scope: !4, type: !7)
|
|
// CHECK:STDOUT: !10 = !DILocation(line: 9, column: 34, scope: !4)
|
|
// CHECK:STDOUT: !11 = !DILocation(line: 9, column: 28, scope: !4)
|
|
// CHECK:STDOUT: !12 = !DILocation(line: 9, column: 21, scope: !4)
|
|
// CHECK:STDOUT: !13 = distinct !DISubprogram(name: "F", linkageName: "_CF:thunk:I.5df87795ec73cda9.Main:X.Main:I.Main", scope: null, file: !3, line: 9, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !14)
|
|
// CHECK:STDOUT: !14 = !{!15}
|
|
// CHECK:STDOUT: !15 = !DILocalVariable(arg: 1, scope: !13, type: !7)
|
|
// CHECK:STDOUT: !16 = !DILocation(line: 9, column: 3, scope: !13)
|
|
// CHECK:STDOUT: !17 = !DILocation(line: 4294967295, scope: !13)
|
|
// CHECK:STDOUT: !18 = distinct !DISubprogram(name: "Op", linkageName: "_COp.77ddf68e618a51fe:core.Destroy.Core", scope: null, file: !3, line: 9, type: !19, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !22)
|
|
// CHECK:STDOUT: !19 = !DISubroutineType(types: !20)
|
|
// CHECK:STDOUT: !20 = !{null, !21}
|
|
// CHECK:STDOUT: !21 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
|
|
// CHECK:STDOUT: !22 = !{!23}
|
|
// CHECK:STDOUT: !23 = !DILocalVariable(arg: 1, scope: !18, type: !21)
|
|
// CHECK:STDOUT: !24 = !DILocation(line: 9, column: 3, scope: !18)
|
|
// CHECK:STDOUT: !25 = distinct !DISubprogram(name: "Op", linkageName: "_COp.88c648e6851ef5ad:core.Destroy.Core", scope: null, file: !3, line: 9, type: !26, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !28)
|
|
// CHECK:STDOUT: !26 = !DISubroutineType(types: !27)
|
|
// CHECK:STDOUT: !27 = !{null, !7}
|
|
// CHECK:STDOUT: !28 = !{!29}
|
|
// CHECK:STDOUT: !29 = !DILocalVariable(arg: 1, scope: !25, type: !7)
|
|
// CHECK:STDOUT: !30 = !DILocation(line: 9, column: 3, scope: !25)
|
|
// CHECK:STDOUT: !31 = distinct !DISubprogram(name: "Op", linkageName: "_COp.4d053df5d5bd57ed:core.Destroy.Core", scope: null, file: !3, line: 9, type: !26, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !32)
|
|
// CHECK:STDOUT: !32 = !{!33}
|
|
// CHECK:STDOUT: !33 = !DILocalVariable(arg: 1, scope: !31, type: !7)
|
|
// CHECK:STDOUT: !34 = !DILocation(line: 9, column: 3, scope: !31)
|
|
// CHECK:STDOUT: ; ModuleID = 'call_thunk_for_imported_interface.carbon'
|
|
// CHECK:STDOUT: source_filename = "call_thunk_for_imported_interface.carbon"
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define void @_CTest.Main(ptr sret({ i32 }) %return, ptr %a) #0 !dbg !4 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: %.loc8_19.1.temp = alloca { i32 }, align 8, !dbg !10
|
|
// CHECK:STDOUT: %.loc8_19.2.temp = alloca { i32 }, align 8, !dbg !10
|
|
// CHECK:STDOUT: %.loc8_18.1.temp = alloca { i32 }, align 8, !dbg !11
|
|
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc8_19.1.temp), !dbg !10
|
|
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc8_19.2.temp), !dbg !10
|
|
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc8_18.1.temp), !dbg !11
|
|
// CHECK:STDOUT: call void @"_CConvert.A.Main:ImplicitAs.d4549ff3b5112a31.Core"(ptr %.loc8_18.1.temp, ptr %a), !dbg !11
|
|
// CHECK:STDOUT: call void @"_CF.X.Main:I.Main"(ptr %.loc8_19.2.temp, ptr %.loc8_18.1.temp), !dbg !10
|
|
// CHECK:STDOUT: call void @"_CConvert.B.Main:ImplicitAs.1bbf6ab9dabb4d99.Core"(ptr %return, ptr %.loc8_19.2.temp), !dbg !12
|
|
// CHECK:STDOUT: call void @"_COp.ceb58d0ffbecdaca:core.Destroy.Core"(ptr %.loc8_19.2.temp), !dbg !10
|
|
// CHECK:STDOUT: call void @"_COp.ceb58d0ffbecdaca:core.Destroy.Core"(ptr %.loc8_18.1.temp), !dbg !11
|
|
// CHECK:STDOUT: ret void, !dbg !12
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: declare void @"_CF:thunk:I.bd5134d7089a5ceb.Main:X.Main:I.Main"(ptr sret({ i32 }), ptr)
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: declare void @"_CF.X.Main:I.Main"(ptr sret({ i32 }), ptr)
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: declare void @"_CConvert.A.Main:ImplicitAs.d4549ff3b5112a31.Core"(ptr sret({ i32 }), ptr)
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: declare void @"_CConvert.B.Main:ImplicitAs.1bbf6ab9dabb4d99.Core"(ptr sret({ i32 }), ptr)
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define weak_odr void @"_COp.77ddf68e618a51fe:core.Destroy.Core"(ptr %self) #0 !dbg !13 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: ret void, !dbg !19
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define weak_odr void @"_COp.88c648e6851ef5ad:core.Destroy.Core"(ptr %self) #0 !dbg !20 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: ret void, !dbg !25
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define weak_odr void @"_COp.ceb58d0ffbecdaca:core.Destroy.Core"(ptr %self) #0 !dbg !26 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: ret void, !dbg !29
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
|
|
// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #1
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; uselistorder directives
|
|
// CHECK:STDOUT: uselistorder ptr @"_COp.ceb58d0ffbecdaca:core.Destroy.Core", { 1, 0 }
|
|
// CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 2, 1, 0 }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: attributes #0 = { nounwind }
|
|
// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
|
|
// CHECK:STDOUT: !llvm.dbg.cu = !{!2}
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
|
|
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
|
|
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
|
|
// CHECK:STDOUT: !3 = !DIFile(filename: "call_thunk_for_imported_interface.carbon", directory: "")
|
|
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Test", linkageName: "_CTest.Main", scope: null, file: !3, line: 7, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !8)
|
|
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
|
|
// CHECK:STDOUT: !6 = !{!7, !7}
|
|
// CHECK:STDOUT: !7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)
|
|
// CHECK:STDOUT: !8 = !{!9}
|
|
// CHECK:STDOUT: !9 = !DILocalVariable(arg: 1, scope: !4, type: !7)
|
|
// CHECK:STDOUT: !10 = !DILocation(line: 8, column: 10, scope: !4)
|
|
// CHECK:STDOUT: !11 = !DILocation(line: 8, column: 18, scope: !4)
|
|
// CHECK:STDOUT: !12 = !DILocation(line: 8, column: 3, scope: !4)
|
|
// CHECK:STDOUT: !13 = distinct !DISubprogram(name: "Op", linkageName: "_COp.77ddf68e618a51fe:core.Destroy.Core", scope: null, file: !3, line: 8, type: !14, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !17)
|
|
// CHECK:STDOUT: !14 = !DISubroutineType(types: !15)
|
|
// CHECK:STDOUT: !15 = !{null, !16}
|
|
// CHECK:STDOUT: !16 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
|
|
// CHECK:STDOUT: !17 = !{!18}
|
|
// CHECK:STDOUT: !18 = !DILocalVariable(arg: 1, scope: !13, type: !16)
|
|
// CHECK:STDOUT: !19 = !DILocation(line: 8, column: 10, scope: !13)
|
|
// CHECK:STDOUT: !20 = distinct !DISubprogram(name: "Op", linkageName: "_COp.88c648e6851ef5ad:core.Destroy.Core", scope: null, file: !3, line: 8, type: !21, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !23)
|
|
// CHECK:STDOUT: !21 = !DISubroutineType(types: !22)
|
|
// CHECK:STDOUT: !22 = !{null, !7}
|
|
// CHECK:STDOUT: !23 = !{!24}
|
|
// CHECK:STDOUT: !24 = !DILocalVariable(arg: 1, scope: !20, type: !7)
|
|
// CHECK:STDOUT: !25 = !DILocation(line: 8, column: 10, scope: !20)
|
|
// CHECK:STDOUT: !26 = distinct !DISubprogram(name: "Op", linkageName: "_COp.ceb58d0ffbecdaca:core.Destroy.Core", scope: null, file: !3, line: 8, type: !21, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !27)
|
|
// CHECK:STDOUT: !27 = !{!28}
|
|
// CHECK:STDOUT: !28 = !DILocalVariable(arg: 1, scope: !26, type: !7)
|
|
// CHECK:STDOUT: !29 = !DILocation(line: 8, column: 10, scope: !26)
|