// 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/full.carbon // // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/interop/cpp/void.carbon // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/interop/cpp/void.carbon // --- void_ptr.h void take_void_ptr(void *p); void take_const_void_ptr(const void *p); void *return_void_ptr(); // --- pass.carbon library "[[@TEST_NAME]]"; import Cpp library "void_ptr.h"; fn PassVoidPtr(a: Cpp.void*) { Cpp.take_void_ptr(a); } fn PassIntPtr(a: Cpp.int*) { Cpp.take_void_ptr(a); } fn PassIntPtrToConstVoidPtr(a: Cpp.int*) { Cpp.take_const_void_ptr(a); } fn PassConstIntPtrToConstVoidPtr(a: const Cpp.int*) { Cpp.take_const_void_ptr(a); } // --- receive.carbon library "[[@TEST_NAME]]"; import Cpp library "void_ptr.h"; fn ReceiveVoidPtr() -> Core.Optional(Cpp.void*) { return Cpp.return_void_ptr(); } fn ConvertFromVoidPtr(p: Cpp.void*) -> i32* { return p unsafe as i32*; } fn ConvertFromConstVoidPtr(p: const Cpp.void*) -> const i32* { return p unsafe as const i32*; } // CHECK:STDOUT: ; --- // CHECK:STDOUT: ; ModuleID = 'pass.carbon' // CHECK:STDOUT: source_filename = "pass.carbon" // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define void @_CPassVoidPtr.Main(ptr %a) #0 !dbg !10 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc7_21.2.temp = alloca ptr, align 8, !dbg !13 // CHECK:STDOUT: %U.as_type.as.ImplicitAs.impl.Convert.call = call ptr @"_CConvert.538322f9fda4254f:ImplicitAs.a276ba298c70ba87.Core.0532bac23645330a"(ptr %a), !dbg !13 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc7_21.2.temp), !dbg !13 // CHECK:STDOUT: store ptr %U.as_type.as.ImplicitAs.impl.Convert.call, ptr %.loc7_21.2.temp, align 8, !dbg !13 // CHECK:STDOUT: %.loc7_21.4 = load ptr, ptr %.loc7_21.2.temp, align 8, !dbg !13 // CHECK:STDOUT: call void @_Z13take_void_ptrPv(ptr %.loc7_21.4), !dbg !16 // CHECK:STDOUT: call void @"_CSelfDestruct.14b4a412ddf73a96:core.Destroy.Core"(ptr %.loc7_21.2.temp), !dbg !13 // CHECK:STDOUT: ret void, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSelfDestruct.00ac8ef5084ea134:core.Destroy.Core"(ptr %self) #0 !dbg !20 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !22 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: declare void @_Z13take_void_ptrPv(ptr noundef) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.a7d1b77eb1279818:core.Destroy.Core"(ptr %self) #0 !dbg !24 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !26 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSelfDestruct.a7d1b77eb1279818:core.Destroy.Core"(ptr %self) #0 !dbg !28 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @"_CSubobjectDestroy.a7d1b77eb1279818:core.Destroy.Core"(ptr %self), !dbg !30 // CHECK:STDOUT: ret void, !dbg !30 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSelfDestruct.174120d4d03791b0:core.Destroy.Core"(ptr %self) #0 !dbg !32 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !34 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSelfDestruct.14b4a412ddf73a96:core.Destroy.Core"(ptr %self) #0 !dbg !36 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !38 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define void @_CPassIntPtr.Main(ptr %a) #0 !dbg !40 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc11_21.2.temp = alloca ptr, align 8, !dbg !43 // CHECK:STDOUT: %U.as_type.as.ImplicitAs.impl.Convert.call = call ptr @"_CConvert.538322f9fda4254f:ImplicitAs.a276ba298c70ba87.Core.6031252d10ea5365"(ptr %a), !dbg !43 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc11_21.2.temp), !dbg !43 // CHECK:STDOUT: store ptr %U.as_type.as.ImplicitAs.impl.Convert.call, ptr %.loc11_21.2.temp, align 8, !dbg !43 // CHECK:STDOUT: %.loc11_21.4 = load ptr, ptr %.loc11_21.2.temp, align 8, !dbg !43 // CHECK:STDOUT: call void @_Z13take_void_ptrPv(ptr %.loc11_21.4), !dbg !44 // CHECK:STDOUT: call void @"_CSelfDestruct.14b4a412ddf73a96:core.Destroy.Core"(ptr %.loc11_21.2.temp), !dbg !43 // CHECK:STDOUT: ret void, !dbg !45 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSelfDestruct.d088c7eb746488be:core.Destroy.Core"(ptr %self) #0 !dbg !47 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !49 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define void @_CPassIntPtrToConstVoidPtr.Main(ptr %a) #0 !dbg !51 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc15_27.2.temp = alloca ptr, align 8, !dbg !54 // CHECK:STDOUT: %U.as_type.as.ImplicitAs.impl.Convert.call = call ptr @"_CConvert.538322f9fda4254f:ImplicitAs.a276ba298c70ba87.Core.d72303bab6c7803c"(ptr %a), !dbg !54 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc15_27.2.temp), !dbg !54 // CHECK:STDOUT: store ptr %U.as_type.as.ImplicitAs.impl.Convert.call, ptr %.loc15_27.2.temp, align 8, !dbg !54 // CHECK:STDOUT: %.loc15_27.4 = load ptr, ptr %.loc15_27.2.temp, align 8, !dbg !54 // CHECK:STDOUT: call void @_Z19take_const_void_ptrPKv(ptr %.loc15_27.4), !dbg !55 // CHECK:STDOUT: call void @"_CSelfDestruct.dfb26e502f641cc5:core.Destroy.Core"(ptr %.loc15_27.2.temp), !dbg !54 // CHECK:STDOUT: ret void, !dbg !56 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSelfDestruct.e9afb99fe676df82:core.Destroy.Core"(ptr %self) #0 !dbg !58 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !60 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: declare void @_Z19take_const_void_ptrPKv(ptr noundef) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.8d3ff16138365f48:core.Destroy.Core"(ptr %self) #0 !dbg !62 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !64 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSelfDestruct.8d3ff16138365f48:core.Destroy.Core"(ptr %self) #0 !dbg !66 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @"_CSubobjectDestroy.8d3ff16138365f48:core.Destroy.Core"(ptr %self), !dbg !68 // CHECK:STDOUT: ret void, !dbg !68 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSelfDestruct.4e1f0f3b7725eea2:core.Destroy.Core"(ptr %self) #0 !dbg !70 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !72 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSelfDestruct.dfb26e502f641cc5:core.Destroy.Core"(ptr %self) #0 !dbg !74 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !76 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define void @_CPassConstIntPtrToConstVoidPtr.Main(ptr %a) #0 !dbg !78 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc19_27.2.temp = alloca ptr, align 8, !dbg !81 // CHECK:STDOUT: %U.as_type.as.ImplicitAs.impl.Convert.call = call ptr @"_CConvert.538322f9fda4254f:ImplicitAs.a276ba298c70ba87.Core.d72303bab6c7803c"(ptr %a), !dbg !81 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc19_27.2.temp), !dbg !81 // CHECK:STDOUT: store ptr %U.as_type.as.ImplicitAs.impl.Convert.call, ptr %.loc19_27.2.temp, align 8, !dbg !81 // CHECK:STDOUT: %.loc19_27.4 = load ptr, ptr %.loc19_27.2.temp, align 8, !dbg !81 // CHECK:STDOUT: call void @_Z19take_const_void_ptrPKv(ptr %.loc19_27.4), !dbg !82 // CHECK:STDOUT: call void @"_CSelfDestruct.dfb26e502f641cc5:core.Destroy.Core"(ptr %.loc19_27.2.temp), !dbg !81 // CHECK:STDOUT: ret void, !dbg !83 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSelfDestruct.7742c7b82efb7924:core.Destroy.Core"(ptr %self) #0 !dbg !85 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !87 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define linkonce_odr ptr @"_CConvert.538322f9fda4254f:ImplicitAs.a276ba298c70ba87.Core.0532bac23645330a"(ptr %self) #0 !dbg !89 { // CHECK:STDOUT: %1 = call ptr @"_CConvert.9fdaf39d07a1dc4e:OptionalAs.24b7347a93330e68.Core.4201ec9a263c5642"(ptr %self), !dbg !94 // CHECK:STDOUT: ret ptr %1, !dbg !95 // 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: ; Function Attrs: nounwind // CHECK:STDOUT: define linkonce_odr ptr @"_CConvert.538322f9fda4254f:ImplicitAs.a276ba298c70ba87.Core.6031252d10ea5365"(ptr %self) #0 !dbg !97 { // CHECK:STDOUT: %1 = call ptr @"_CConvert.d62727437df45535:OptionalAs.1dac4564233fecd1.Core.1e16d6a5a3286ade"(ptr %self), !dbg !102 // CHECK:STDOUT: ret ptr %1, !dbg !103 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define linkonce_odr ptr @"_CConvert.538322f9fda4254f:ImplicitAs.a276ba298c70ba87.Core.d72303bab6c7803c"(ptr %self) #0 !dbg !105 { // CHECK:STDOUT: %1 = call ptr @"_CConvert.d62727437df45535:OptionalAs.1dac4564233fecd1.Core.ea6f599e1a77a7ea"(ptr %self), !dbg !110 // CHECK:STDOUT: ret ptr %1, !dbg !111 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define linkonce_odr ptr @"_CConvert.9fdaf39d07a1dc4e:OptionalAs.24b7347a93330e68.Core.4201ec9a263c5642"(ptr %self) #0 !dbg !121 { // CHECK:STDOUT: %1 = call ptr @_CSome.Optional.Core.4201ec9a263c5642(ptr %self), !dbg !127 // CHECK:STDOUT: ret ptr %1, !dbg !128 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define linkonce_odr ptr @"_CConvert.d62727437df45535:OptionalAs.1dac4564233fecd1.Core.1e16d6a5a3286ade"(ptr %self) #0 !dbg !130 { // CHECK:STDOUT: %temp = alloca ptr, align 8, !dbg !135 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %temp), !dbg !135 // CHECK:STDOUT: store ptr %self, ptr %temp, align 8, !dbg !135 // CHECK:STDOUT: %1 = load ptr, ptr %temp, align 8, !dbg !135 // CHECK:STDOUT: %2 = call ptr @_CSome.Optional.Core.4201ec9a263c5642(ptr %1), !dbg !136 // CHECK:STDOUT: call void @"_CSelfDestruct.00ac8ef5084ea134:core.Destroy.Core"(ptr %temp), !dbg !135 // CHECK:STDOUT: ret ptr %2, !dbg !137 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define linkonce_odr ptr @"_CConvert.d62727437df45535:OptionalAs.1dac4564233fecd1.Core.ea6f599e1a77a7ea"(ptr %self) #0 !dbg !139 { // CHECK:STDOUT: %temp = alloca ptr, align 8, !dbg !144 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %temp), !dbg !144 // CHECK:STDOUT: %1 = call ptr @"_CConvert:thunk:ImplicitAs.a569d188b7ffe592.Core:e8f8f92d3d08d149:ImplicitAs.01c4a560c986e7d1.Core.84588f41d61dafba"(ptr %self), !dbg !144 // CHECK:STDOUT: store ptr %1, ptr %temp, align 8, !dbg !144 // CHECK:STDOUT: %2 = load ptr, ptr %temp, align 8, !dbg !144 // CHECK:STDOUT: %3 = call ptr @_CSome.Optional.Core.e4523e01ac2590ba(ptr %2), !dbg !145 // CHECK:STDOUT: call void @"_CSelfDestruct.e9afb99fe676df82:core.Destroy.Core"(ptr %temp), !dbg !144 // CHECK:STDOUT: ret ptr %3, !dbg !146 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define linkonce_odr ptr @_CSome.Optional.Core.4201ec9a263c5642(ptr %value) #0 !dbg !157 { // CHECK:STDOUT: %1 = call ptr @"_CSome.e8f8f92d3d08d149:OptionalStorage.Core.7a595a06c724a271"(ptr %value), !dbg !162 // CHECK:STDOUT: ret ptr %1, !dbg !163 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline nounwind // CHECK:STDOUT: define linkonce_odr ptr @"_CConvert:thunk:ImplicitAs.a569d188b7ffe592.Core:e8f8f92d3d08d149:ImplicitAs.01c4a560c986e7d1.Core.84588f41d61dafba"(ptr %self) #3 !dbg !166 { // CHECK:STDOUT: ret ptr %self, !dbg !169 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define linkonce_odr ptr @_CSome.Optional.Core.e4523e01ac2590ba(ptr %value) #0 !dbg !171 { // CHECK:STDOUT: %1 = call ptr @"_CSome.e8f8f92d3d08d149:OptionalStorage.Core.8f1054b47505c137"(ptr %value), !dbg !176 // CHECK:STDOUT: ret ptr %1, !dbg !177 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define linkonce_odr ptr @"_CSome.e8f8f92d3d08d149:OptionalStorage.Core.7a595a06c724a271"(ptr %self) #0 !dbg !184 { // CHECK:STDOUT: %1 = alloca ptr, align 8, !dbg !189 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %1), !dbg !189 // CHECK:STDOUT: store ptr poison, ptr %1, align 8, !dbg !189 // CHECK:STDOUT: store ptr %self, ptr %1, align 8, !dbg !193 // CHECK:STDOUT: %2 = load ptr, ptr %1, align 8, !dbg !191 // CHECK:STDOUT: call void @"_CSelfDestruct.174120d4d03791b0:core.Destroy.Core"(ptr %1), !dbg !189 // CHECK:STDOUT: ret ptr %2, !dbg !195 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define linkonce_odr ptr @"_CSome.e8f8f92d3d08d149:OptionalStorage.Core.8f1054b47505c137"(ptr %self) #0 !dbg !197 { // CHECK:STDOUT: %1 = alloca ptr, align 8, !dbg !202 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %1), !dbg !202 // CHECK:STDOUT: store ptr poison, ptr %1, align 8, !dbg !202 // CHECK:STDOUT: store ptr %self, ptr %1, align 8, !dbg !206 // CHECK:STDOUT: %2 = load ptr, ptr %1, align 8, !dbg !204 // CHECK:STDOUT: call void @"_CSelfDestruct.4e1f0f3b7725eea2:core.Destroy.Core"(ptr %1), !dbg !202 // CHECK:STDOUT: ret ptr %2, !dbg !208 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 0, 1, 2, 3, 7, 6, 5, 4 } // CHECK:STDOUT: uselistorder ptr @"_CConvert.538322f9fda4254f:ImplicitAs.a276ba298c70ba87.Core.d72303bab6c7803c", { 1, 0 } // CHECK:STDOUT: uselistorder ptr @_CSome.Optional.Core.4201ec9a263c5642, { 1, 0 } // CHECK:STDOUT: // CHECK:STDOUT: attributes #0 = { nounwind } // CHECK:STDOUT: attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: attributes #3 = { alwaysinline nounwind } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.dbg.cu = !{!5} // CHECK:STDOUT: !llvm.module.flags = !{!210, !211, !212, !2, !3} // CHECK:STDOUT: !llvm.errno.tbaa = !{!217} // CHECK:STDOUT: // CHECK:STDOUT: !2 = !{i32 7, !"Dwarf Version", i32 5} // CHECK:STDOUT: !3 = !{i32 2, !"Debug Info Version", i32 3} // CHECK:STDOUT: !4 = !DIFile(filename: "pass.carbon", directory: "") // CHECK:STDOUT: !5 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !4, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) // CHECK:STDOUT: !7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) // CHECK:STDOUT: !8 = !{null, !7} // CHECK:STDOUT: !9 = !DISubroutineType(types: !8) // CHECK:STDOUT: !10 = distinct !DISubprogram(name: "PassVoidPtr", linkageName: "_CPassVoidPtr.Main", scope: null, file: !4, line: 6, type: !9, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !18) // CHECK:STDOUT: !11 = !DILocalVariable(arg: 1, scope: !10, type: !7) // CHECK:STDOUT: !13 = !DILocation(line: 7, column: 21, scope: !10) // CHECK:STDOUT: !14 = !{!7, !7} // CHECK:STDOUT: !15 = !DISubroutineType(types: !14) // CHECK:STDOUT: !16 = !DILocation(line: 7, column: 3, scope: !10) // CHECK:STDOUT: !17 = !DILocation(line: 6, column: 1, scope: !10) // CHECK:STDOUT: !18 = !{!11} // CHECK:STDOUT: !19 = !DIFile(filename: "{{.*}}/prelude/types/optional.carbon", directory: "") // CHECK:STDOUT: !20 = distinct !DISubprogram(name: "SelfDestruct", linkageName: "_CSelfDestruct.00ac8ef5084ea134:core.Destroy.Core", scope: null, file: !19, line: 164, type: !9, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !23) // CHECK:STDOUT: !21 = !DILocalVariable(arg: 1, scope: !20, type: !7) // CHECK:STDOUT: !22 = !DILocation(line: 164, column: 19, scope: !20) // CHECK:STDOUT: !23 = !{!21} // CHECK:STDOUT: !24 = distinct !DISubprogram(name: "SubobjectDestroy", linkageName: "_CSubobjectDestroy.a7d1b77eb1279818:core.Destroy.Core", scope: null, file: !4, line: 7, type: !9, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !27) // CHECK:STDOUT: !25 = !DILocalVariable(arg: 1, scope: !24, type: !7) // CHECK:STDOUT: !26 = !DILocation(line: 7, column: 21, scope: !24) // CHECK:STDOUT: !27 = !{!25} // CHECK:STDOUT: !28 = distinct !DISubprogram(name: "SelfDestruct", linkageName: "_CSelfDestruct.a7d1b77eb1279818:core.Destroy.Core", scope: null, file: !4, line: 7, type: !9, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !31) // CHECK:STDOUT: !29 = !DILocalVariable(arg: 1, scope: !28, type: !7) // CHECK:STDOUT: !30 = !DILocation(line: 7, column: 21, scope: !28) // CHECK:STDOUT: !31 = !{!29} // CHECK:STDOUT: !32 = distinct !DISubprogram(name: "SelfDestruct", linkageName: "_CSelfDestruct.174120d4d03791b0:core.Destroy.Core", scope: null, file: !4, line: 7, type: !9, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !35) // CHECK:STDOUT: !33 = !DILocalVariable(arg: 1, scope: !32, type: !7) // CHECK:STDOUT: !34 = !DILocation(line: 7, column: 21, scope: !32) // CHECK:STDOUT: !35 = !{!33} // CHECK:STDOUT: !36 = distinct !DISubprogram(name: "SelfDestruct", linkageName: "_CSelfDestruct.14b4a412ddf73a96:core.Destroy.Core", scope: null, file: !4, line: 7, type: !9, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !39) // CHECK:STDOUT: !37 = !DILocalVariable(arg: 1, scope: !36, type: !7) // CHECK:STDOUT: !38 = !DILocation(line: 7, column: 21, scope: !36) // CHECK:STDOUT: !39 = !{!37} // CHECK:STDOUT: !40 = distinct !DISubprogram(name: "PassIntPtr", linkageName: "_CPassIntPtr.Main", scope: null, file: !4, line: 10, type: !9, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !46) // CHECK:STDOUT: !41 = !DILocalVariable(arg: 1, scope: !40, type: !7) // CHECK:STDOUT: !43 = !DILocation(line: 11, column: 21, scope: !40) // CHECK:STDOUT: !44 = !DILocation(line: 11, column: 3, scope: !40) // CHECK:STDOUT: !45 = !DILocation(line: 10, column: 1, scope: !40) // CHECK:STDOUT: !46 = !{!41} // CHECK:STDOUT: !47 = distinct !DISubprogram(name: "SelfDestruct", linkageName: "_CSelfDestruct.d088c7eb746488be:core.Destroy.Core", scope: null, file: !19, line: 164, type: !9, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !50) // CHECK:STDOUT: !48 = !DILocalVariable(arg: 1, scope: !47, type: !7) // CHECK:STDOUT: !49 = !DILocation(line: 164, column: 19, scope: !47) // CHECK:STDOUT: !50 = !{!48} // CHECK:STDOUT: !51 = distinct !DISubprogram(name: "PassIntPtrToConstVoidPtr", linkageName: "_CPassIntPtrToConstVoidPtr.Main", scope: null, file: !4, line: 14, type: !9, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !57) // CHECK:STDOUT: !52 = !DILocalVariable(arg: 1, scope: !51, type: !7) // CHECK:STDOUT: !54 = !DILocation(line: 15, column: 27, scope: !51) // CHECK:STDOUT: !55 = !DILocation(line: 15, column: 3, scope: !51) // CHECK:STDOUT: !56 = !DILocation(line: 14, column: 1, scope: !51) // CHECK:STDOUT: !57 = !{!52} // CHECK:STDOUT: !58 = distinct !DISubprogram(name: "SelfDestruct", linkageName: "_CSelfDestruct.e9afb99fe676df82:core.Destroy.Core", scope: null, file: !19, line: 164, type: !9, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !61) // CHECK:STDOUT: !59 = !DILocalVariable(arg: 1, scope: !58, type: !7) // CHECK:STDOUT: !60 = !DILocation(line: 164, column: 19, scope: !58) // CHECK:STDOUT: !61 = !{!59} // CHECK:STDOUT: !62 = distinct !DISubprogram(name: "SubobjectDestroy", linkageName: "_CSubobjectDestroy.8d3ff16138365f48:core.Destroy.Core", scope: null, file: !4, line: 15, type: !9, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !65) // CHECK:STDOUT: !63 = !DILocalVariable(arg: 1, scope: !62, type: !7) // CHECK:STDOUT: !64 = !DILocation(line: 15, column: 27, scope: !62) // CHECK:STDOUT: !65 = !{!63} // CHECK:STDOUT: !66 = distinct !DISubprogram(name: "SelfDestruct", linkageName: "_CSelfDestruct.8d3ff16138365f48:core.Destroy.Core", scope: null, file: !4, line: 15, type: !9, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !69) // CHECK:STDOUT: !67 = !DILocalVariable(arg: 1, scope: !66, type: !7) // CHECK:STDOUT: !68 = !DILocation(line: 15, column: 27, scope: !66) // CHECK:STDOUT: !69 = !{!67} // CHECK:STDOUT: !70 = distinct !DISubprogram(name: "SelfDestruct", linkageName: "_CSelfDestruct.4e1f0f3b7725eea2:core.Destroy.Core", scope: null, file: !4, line: 15, type: !9, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !73) // CHECK:STDOUT: !71 = !DILocalVariable(arg: 1, scope: !70, type: !7) // CHECK:STDOUT: !72 = !DILocation(line: 15, column: 27, scope: !70) // CHECK:STDOUT: !73 = !{!71} // CHECK:STDOUT: !74 = distinct !DISubprogram(name: "SelfDestruct", linkageName: "_CSelfDestruct.dfb26e502f641cc5:core.Destroy.Core", scope: null, file: !4, line: 15, type: !9, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !77) // CHECK:STDOUT: !75 = !DILocalVariable(arg: 1, scope: !74, type: !7) // CHECK:STDOUT: !76 = !DILocation(line: 15, column: 27, scope: !74) // CHECK:STDOUT: !77 = !{!75} // CHECK:STDOUT: !78 = distinct !DISubprogram(name: "PassConstIntPtrToConstVoidPtr", linkageName: "_CPassConstIntPtrToConstVoidPtr.Main", scope: null, file: !4, line: 18, type: !9, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !84) // CHECK:STDOUT: !79 = !DILocalVariable(arg: 1, scope: !78, type: !7) // CHECK:STDOUT: !81 = !DILocation(line: 19, column: 27, scope: !78) // CHECK:STDOUT: !82 = !DILocation(line: 19, column: 3, scope: !78) // CHECK:STDOUT: !83 = !DILocation(line: 18, column: 1, scope: !78) // CHECK:STDOUT: !84 = !{!79} // CHECK:STDOUT: !85 = distinct !DISubprogram(name: "SelfDestruct", linkageName: "_CSelfDestruct.7742c7b82efb7924:core.Destroy.Core", scope: null, file: !19, line: 164, type: !9, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !88) // CHECK:STDOUT: !86 = !DILocalVariable(arg: 1, scope: !85, type: !7) // CHECK:STDOUT: !87 = !DILocation(line: 164, column: 19, scope: !85) // CHECK:STDOUT: !88 = !{!86} // CHECK:STDOUT: !89 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.538322f9fda4254f:ImplicitAs.a276ba298c70ba87.Core.0532bac23645330a", scope: null, file: !19, line: 105, type: !15, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !96) // CHECK:STDOUT: !90 = !DILocalVariable(arg: 1, scope: !89, type: !7) // CHECK:STDOUT: !94 = !DILocation(line: 106, column: 12, scope: !89) // CHECK:STDOUT: !95 = !DILocation(line: 106, column: 5, scope: !89) // CHECK:STDOUT: !96 = !{!90} // CHECK:STDOUT: !97 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.538322f9fda4254f:ImplicitAs.a276ba298c70ba87.Core.6031252d10ea5365", scope: null, file: !19, line: 105, type: !15, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !104) // CHECK:STDOUT: !98 = !DILocalVariable(arg: 1, scope: !97, type: !7) // CHECK:STDOUT: !102 = !DILocation(line: 106, column: 12, scope: !97) // CHECK:STDOUT: !103 = !DILocation(line: 106, column: 5, scope: !97) // CHECK:STDOUT: !104 = !{!98} // CHECK:STDOUT: !105 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.538322f9fda4254f:ImplicitAs.a276ba298c70ba87.Core.d72303bab6c7803c", scope: null, file: !19, line: 105, type: !15, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !112) // CHECK:STDOUT: !106 = !DILocalVariable(arg: 1, scope: !105, type: !7) // CHECK:STDOUT: !110 = !DILocation(line: 106, column: 12, scope: !105) // CHECK:STDOUT: !111 = !DILocation(line: 106, column: 5, scope: !105) // CHECK:STDOUT: !112 = !{!106} // CHECK:STDOUT: !121 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.9fdaf39d07a1dc4e:OptionalAs.24b7347a93330e68.Core.4201ec9a263c5642", scope: null, file: !19, line: 80, type: !15, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !129) // CHECK:STDOUT: !122 = !DILocalVariable(arg: 1, scope: !121, type: !7) // CHECK:STDOUT: !127 = !DILocation(line: 81, column: 12, scope: !121) // CHECK:STDOUT: !128 = !DILocation(line: 81, column: 5, scope: !121) // CHECK:STDOUT: !129 = !{!122} // CHECK:STDOUT: !130 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.d62727437df45535:OptionalAs.1dac4564233fecd1.Core.1e16d6a5a3286ade", scope: null, file: !19, line: 87, type: !15, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !138) // CHECK:STDOUT: !131 = !DILocalVariable(arg: 1, scope: !130, type: !7) // CHECK:STDOUT: !135 = !DILocation(line: 88, column: 29, scope: !130) // CHECK:STDOUT: !136 = !DILocation(line: 88, column: 12, scope: !130) // CHECK:STDOUT: !137 = !DILocation(line: 88, column: 5, scope: !130) // CHECK:STDOUT: !138 = !{!131} // CHECK:STDOUT: !139 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.d62727437df45535:OptionalAs.1dac4564233fecd1.Core.ea6f599e1a77a7ea", scope: null, file: !19, line: 87, type: !15, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !147) // CHECK:STDOUT: !140 = !DILocalVariable(arg: 1, scope: !139, type: !7) // CHECK:STDOUT: !144 = !DILocation(line: 88, column: 29, scope: !139) // CHECK:STDOUT: !145 = !DILocation(line: 88, column: 12, scope: !139) // CHECK:STDOUT: !146 = !DILocation(line: 88, column: 5, scope: !139) // CHECK:STDOUT: !147 = !{!140} // CHECK:STDOUT: !157 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.Optional.Core.4201ec9a263c5642", scope: null, file: !19, line: 33, type: !15, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !164) // CHECK:STDOUT: !158 = !DILocalVariable(arg: 1, scope: !157, type: !7) // CHECK:STDOUT: !162 = !DILocation(line: 34, column: 12, scope: !157) // CHECK:STDOUT: !163 = !DILocation(line: 34, column: 5, scope: !157) // CHECK:STDOUT: !164 = !{!158} // CHECK:STDOUT: !165 = !DIFile(filename: "{{.*}}/prelude/types/cpp/void.carbon", directory: "") // CHECK:STDOUT: !166 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert:thunk:ImplicitAs.a569d188b7ffe592.Core:e8f8f92d3d08d149:ImplicitAs.01c4a560c986e7d1.Core.84588f41d61dafba", scope: null, file: !165, line: 40, type: !15, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !170) // CHECK:STDOUT: !167 = !DILocalVariable(arg: 1, scope: !166, type: !7) // CHECK:STDOUT: !169 = !DILocation(line: 40, column: 3, scope: !166) // CHECK:STDOUT: !170 = !{!167} // CHECK:STDOUT: !171 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.Optional.Core.e4523e01ac2590ba", scope: null, file: !19, line: 33, type: !15, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !178) // CHECK:STDOUT: !172 = !DILocalVariable(arg: 1, scope: !171, type: !7) // CHECK:STDOUT: !176 = !DILocation(line: 34, column: 12, scope: !171) // CHECK:STDOUT: !177 = !DILocation(line: 34, column: 5, scope: !171) // CHECK:STDOUT: !178 = !{!172} // CHECK:STDOUT: !184 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.e8f8f92d3d08d149:OptionalStorage.Core.7a595a06c724a271", scope: null, file: !19, line: 166, type: !15, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !196) // CHECK:STDOUT: !185 = !DILocalVariable(arg: 1, scope: !184, type: !7) // CHECK:STDOUT: !189 = !DILocation(line: 167, column: 14, scope: !184) // CHECK:STDOUT: !191 = !DILocation(line: 167, column: 18, scope: !184) // CHECK:STDOUT: !193 = !DILocation(line: 169, column: 5, scope: !184) // CHECK:STDOUT: !195 = !DILocation(line: 170, column: 5, scope: !184) // CHECK:STDOUT: !196 = !{!185} // CHECK:STDOUT: !197 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.e8f8f92d3d08d149:OptionalStorage.Core.8f1054b47505c137", scope: null, file: !19, line: 166, type: !15, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !209) // CHECK:STDOUT: !198 = !DILocalVariable(arg: 1, scope: !197, type: !7) // CHECK:STDOUT: !202 = !DILocation(line: 167, column: 14, scope: !197) // CHECK:STDOUT: !204 = !DILocation(line: 167, column: 18, scope: !197) // CHECK:STDOUT: !206 = !DILocation(line: 169, column: 5, scope: !197) // CHECK:STDOUT: !208 = !DILocation(line: 170, column: 5, scope: !197) // CHECK:STDOUT: !209 = !{!198} // CHECK:STDOUT: !210 = !{i32 8, !"PIC Level", i32 2} // CHECK:STDOUT: !211 = !{i32 7, !"PIE Level", i32 2} // CHECK:STDOUT: !212 = !{i32 7, !"uwtable", i32 2} // CHECK:STDOUT: !213 = !{!"Simple C++ TBAA"} // CHECK:STDOUT: !214 = !{!"omnipotent char", !213, i64 0} // CHECK:STDOUT: !215 = !{!"int", !214, i64 0} // CHECK:STDOUT: !216 = !{!"__libc_errno", !215, i64 0} // CHECK:STDOUT: !217 = !{!216, !215, i64 0} // CHECK:STDOUT: // CHECK:STDOUT: ; --- // CHECK:STDOUT: ; ModuleID = 'receive.carbon' // CHECK:STDOUT: source_filename = "receive.carbon" // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSelfDestruct.00ac8ef5084ea134:core.Destroy.Core"(ptr %self) #0 !dbg !222 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !224 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define ptr @_CReceiveVoidPtr.Main() #0 !dbg !226 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %return_void_ptr.call = call ptr @_Z15return_void_ptrv(), !dbg !229 // CHECK:STDOUT: ret ptr %return_void_ptr.call, !dbg !230 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: declare noundef ptr @_Z15return_void_ptrv() #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define ptr @_CConvertFromVoidPtr.Main(ptr %p) #0 !dbg !231 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret ptr %p, !dbg !237 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define ptr @_CConvertFromConstVoidPtr.Main(ptr %p) #0 !dbg !239 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret ptr %p, !dbg !245 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: attributes #0 = { nounwind } // CHECK:STDOUT: attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.dbg.cu = !{!219} // CHECK:STDOUT: !llvm.module.flags = !{!210, !211, !212, !2, !3} // CHECK:STDOUT: !llvm.errno.tbaa = !{!217} // CHECK:STDOUT: // CHECK:STDOUT: !2 = !{i32 7, !"Dwarf Version", i32 5} // CHECK:STDOUT: !3 = !{i32 2, !"Debug Info Version", i32 3} // CHECK:STDOUT: !7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) // CHECK:STDOUT: !8 = !{null, !7} // CHECK:STDOUT: !9 = !DISubroutineType(types: !8) // CHECK:STDOUT: !14 = !{!7, !7} // CHECK:STDOUT: !15 = !DISubroutineType(types: !14) // CHECK:STDOUT: !19 = !DIFile(filename: "{{.*}}/prelude/types/optional.carbon", directory: "") // CHECK:STDOUT: !210 = !{i32 8, !"PIC Level", i32 2} // CHECK:STDOUT: !211 = !{i32 7, !"PIE Level", i32 2} // CHECK:STDOUT: !212 = !{i32 7, !"uwtable", i32 2} // CHECK:STDOUT: !213 = !{!"Simple C++ TBAA"} // CHECK:STDOUT: !214 = !{!"omnipotent char", !213, i64 0} // CHECK:STDOUT: !215 = !{!"int", !214, i64 0} // CHECK:STDOUT: !216 = !{!"__libc_errno", !215, i64 0} // CHECK:STDOUT: !217 = !{!216, !215, i64 0} // CHECK:STDOUT: !218 = !DIFile(filename: "receive.carbon", directory: "") // CHECK:STDOUT: !219 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !218, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug) // CHECK:STDOUT: !220 = !{!7} // CHECK:STDOUT: !221 = !DISubroutineType(types: !220) // CHECK:STDOUT: !222 = distinct !DISubprogram(name: "SelfDestruct", linkageName: "_CSelfDestruct.00ac8ef5084ea134:core.Destroy.Core", scope: null, file: !19, line: 164, type: !9, spFlags: DISPFlagDefinition, unit: !219, retainedNodes: !225) // CHECK:STDOUT: !223 = !DILocalVariable(arg: 1, scope: !222, type: !7) // CHECK:STDOUT: !224 = !DILocation(line: 164, column: 19, scope: !222) // CHECK:STDOUT: !225 = !{!223} // CHECK:STDOUT: !226 = distinct !DISubprogram(name: "ReceiveVoidPtr", linkageName: "_CReceiveVoidPtr.Main", scope: null, file: !218, line: 6, type: !221, spFlags: DISPFlagDefinition, unit: !219) // CHECK:STDOUT: !229 = !DILocation(line: 7, column: 10, scope: !226) // CHECK:STDOUT: !230 = !DILocation(line: 7, column: 3, scope: !226) // CHECK:STDOUT: !231 = distinct !DISubprogram(name: "ConvertFromVoidPtr", linkageName: "_CConvertFromVoidPtr.Main", scope: null, file: !218, line: 10, type: !15, spFlags: DISPFlagDefinition, unit: !219, retainedNodes: !238) // CHECK:STDOUT: !232 = !DILocalVariable(arg: 1, scope: !231, type: !7) // CHECK:STDOUT: !237 = !DILocation(line: 11, column: 3, scope: !231) // CHECK:STDOUT: !238 = !{!232} // CHECK:STDOUT: !239 = distinct !DISubprogram(name: "ConvertFromConstVoidPtr", linkageName: "_CConvertFromConstVoidPtr.Main", scope: null, file: !218, line: 14, type: !15, spFlags: DISPFlagDefinition, unit: !219, retainedNodes: !246) // CHECK:STDOUT: !240 = !DILocalVariable(arg: 1, scope: !239, type: !7) // CHECK:STDOUT: !245 = !DILocation(line: 15, column: 3, scope: !239) // CHECK:STDOUT: !246 = !{!240} // CHECK:STDOUT: