mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-27 04:01:20 +00:00
https://carbon.compiler-explorer.com/z/88K9Kh5Wo shows the program exiting with a garbage value copied from uninitialized memory. This PR modifies `lower` to detect if the function lowered is the entry point and doesn't specify a return type. If so, it emits different LLVM IR to return int32 0, and modifies the lowered function signature to match the int32 return type.
351 lines
19 KiB
Plaintext
351 lines
19 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/class/field.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/class/field.carbon
|
|
|
|
// --- basic.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
class C {
|
|
var a: i32;
|
|
var b: C*;
|
|
}
|
|
|
|
fn F(c: C) -> i32 {
|
|
return (*c.b).a;
|
|
}
|
|
|
|
fn Run() -> i32 {
|
|
var c: C;
|
|
c.a = 1;
|
|
c.b = &c;
|
|
return F(c);
|
|
}
|
|
|
|
// --- inplace_init_with_nonconst.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
class Other { }
|
|
|
|
class Use {
|
|
var a: Other*;
|
|
var b: Other;
|
|
}
|
|
|
|
fn Run() {
|
|
var o: Other;
|
|
// .a is initialized with a non-constant expression
|
|
// .b is initialized with in-place class_init
|
|
var _: Use = {.a = &o, .b = {}};
|
|
}
|
|
|
|
// --- implicit_init_with_nonempty_nonconst.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
class Other {
|
|
var v: i32;
|
|
}
|
|
|
|
class Use {
|
|
var a: Other*;
|
|
var b: Other;
|
|
}
|
|
|
|
fn Run() {
|
|
var o: Other;
|
|
// .a is initialized with a non-constant expression
|
|
// .b is initialized with in-place class_init
|
|
var _: Use = {.a = &o, .b = {.v = 42}};
|
|
}
|
|
|
|
// CHECK:STDOUT: ; ModuleID = 'basic.carbon'
|
|
// CHECK:STDOUT: source_filename = "basic.carbon"
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define i32 @_CF.Main(ptr %c) #0 !dbg !4 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: %.loc10_13.1.b = getelementptr inbounds nuw { i32, ptr }, ptr %c, i32 0, i32 1, !dbg !11
|
|
// CHECK:STDOUT: %.loc10_13.2 = load ptr, ptr %.loc10_13.1.b, align 8, !dbg !11
|
|
// CHECK:STDOUT: %.loc10_16.1.a = getelementptr inbounds nuw { i32, ptr }, ptr %.loc10_13.2, i32 0, i32 0, !dbg !12
|
|
// CHECK:STDOUT: %.loc10_16.2 = load i32, ptr %.loc10_16.1.a, align 4, !dbg !12
|
|
// CHECK:STDOUT: ret i32 %.loc10_16.2, !dbg !13
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define i32 @main() #0 !dbg !14 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: %c.var = alloca { i32, ptr }, align 8, !dbg !17
|
|
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %c.var), !dbg !17
|
|
// CHECK:STDOUT: %.loc15_4.a = getelementptr inbounds nuw { i32, ptr }, ptr %c.var, i32 0, i32 0, !dbg !18
|
|
// CHECK:STDOUT: store i32 1, ptr %.loc15_4.a, align 4, !dbg !18
|
|
// CHECK:STDOUT: %.loc16.b = getelementptr inbounds nuw { i32, ptr }, ptr %c.var, i32 0, i32 1, !dbg !19
|
|
// CHECK:STDOUT: store ptr %c.var, ptr %.loc16.b, align 8, !dbg !19
|
|
// CHECK:STDOUT: %F.call = call i32 @_CF.Main(ptr %c.var), !dbg !20
|
|
// CHECK:STDOUT: call void @"_COp.71e25083d63c4d6c:core.Destroy.Core"(ptr %c.var), !dbg !17
|
|
// CHECK:STDOUT: ret i32 %F.call, !dbg !21
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define weak_odr void @"_COp.7e389eab4a7e5487:core.Destroy.Core"(ptr %self) #0 !dbg !22 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: ret void, !dbg !27
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define weak_odr void @"_COp.e7e7253cfbad8551:core.Destroy.Core"(ptr %self) #0 !dbg !28 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: ret void, !dbg !33
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define weak_odr void @"_COp.71e25083d63c4d6c:core.Destroy.Core"(ptr %self) #0 !dbg !34 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: ret void, !dbg !37
|
|
// 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: 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: "basic.carbon", directory: "")
|
|
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", linkageName: "_CF.Main", scope: null, file: !3, line: 9, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !9)
|
|
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
|
|
// CHECK:STDOUT: !6 = !{!7, !8}
|
|
// CHECK:STDOUT: !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
|
|
// CHECK:STDOUT: !8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)
|
|
// CHECK:STDOUT: !9 = !{!10}
|
|
// CHECK:STDOUT: !10 = !DILocalVariable(arg: 1, scope: !4, type: !8)
|
|
// CHECK:STDOUT: !11 = !DILocation(line: 10, column: 12, scope: !4)
|
|
// CHECK:STDOUT: !12 = !DILocation(line: 10, column: 10, scope: !4)
|
|
// CHECK:STDOUT: !13 = !DILocation(line: 10, column: 3, scope: !4)
|
|
// CHECK:STDOUT: !14 = distinct !DISubprogram(name: "Run", linkageName: "main", scope: null, file: !3, line: 13, type: !15, spFlags: DISPFlagDefinition, unit: !2)
|
|
// CHECK:STDOUT: !15 = !DISubroutineType(types: !16)
|
|
// CHECK:STDOUT: !16 = !{!7}
|
|
// CHECK:STDOUT: !17 = !DILocation(line: 14, column: 3, scope: !14)
|
|
// CHECK:STDOUT: !18 = !DILocation(line: 15, column: 3, scope: !14)
|
|
// CHECK:STDOUT: !19 = !DILocation(line: 16, column: 3, scope: !14)
|
|
// CHECK:STDOUT: !20 = !DILocation(line: 17, column: 10, scope: !14)
|
|
// CHECK:STDOUT: !21 = !DILocation(line: 17, column: 3, scope: !14)
|
|
// CHECK:STDOUT: !22 = distinct !DISubprogram(name: "Op", linkageName: "_COp.7e389eab4a7e5487:core.Destroy.Core", scope: null, file: !3, line: 14, type: !23, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !25)
|
|
// CHECK:STDOUT: !23 = !DISubroutineType(types: !24)
|
|
// CHECK:STDOUT: !24 = !{null, !7}
|
|
// CHECK:STDOUT: !25 = !{!26}
|
|
// CHECK:STDOUT: !26 = !DILocalVariable(arg: 1, scope: !22, type: !7)
|
|
// CHECK:STDOUT: !27 = !DILocation(line: 14, column: 3, scope: !22)
|
|
// CHECK:STDOUT: !28 = distinct !DISubprogram(name: "Op", linkageName: "_COp.e7e7253cfbad8551:core.Destroy.Core", scope: null, file: !3, line: 14, type: !29, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !31)
|
|
// CHECK:STDOUT: !29 = !DISubroutineType(types: !30)
|
|
// CHECK:STDOUT: !30 = !{null, !8}
|
|
// CHECK:STDOUT: !31 = !{!32}
|
|
// CHECK:STDOUT: !32 = !DILocalVariable(arg: 1, scope: !28, type: !8)
|
|
// CHECK:STDOUT: !33 = !DILocation(line: 14, column: 3, scope: !28)
|
|
// CHECK:STDOUT: !34 = distinct !DISubprogram(name: "Op", linkageName: "_COp.71e25083d63c4d6c:core.Destroy.Core", scope: null, file: !3, line: 14, type: !29, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !35)
|
|
// CHECK:STDOUT: !35 = !{!36}
|
|
// CHECK:STDOUT: !36 = !DILocalVariable(arg: 1, scope: !34, type: !8)
|
|
// CHECK:STDOUT: !37 = !DILocation(line: 14, column: 3, scope: !34)
|
|
// CHECK:STDOUT: ; ModuleID = 'inplace_init_with_nonconst.carbon'
|
|
// CHECK:STDOUT: source_filename = "inplace_init_with_nonconst.carbon"
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: @Other.val.loc15_33.5 = internal constant {} zeroinitializer
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define i32 @main() #0 !dbg !4 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: %o.var = alloca {}, align 8, !dbg !8
|
|
// CHECK:STDOUT: %_.var = alloca { ptr, {} }, align 8, !dbg !9
|
|
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %o.var), !dbg !8
|
|
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %_.var), !dbg !9
|
|
// CHECK:STDOUT: %.loc15_33.2.a = getelementptr inbounds nuw { ptr, {} }, ptr %_.var, i32 0, i32 0, !dbg !10
|
|
// CHECK:STDOUT: store ptr %o.var, ptr %.loc15_33.2.a, align 8, !dbg !10
|
|
// CHECK:STDOUT: %.loc15_33.4.b = getelementptr inbounds nuw { ptr, {} }, ptr %_.var, i32 0, i32 1, !dbg !10
|
|
// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %.loc15_33.4.b, ptr align 1 @Other.val.loc15_33.5, i64 0, i1 false), !dbg !10
|
|
// CHECK:STDOUT: call void @"_COp.6354d5454c7bf77d:core.Destroy.Core"(ptr %_.var), !dbg !9
|
|
// CHECK:STDOUT: call void @"_COp.49a4972657b05a86:core.Destroy.Core"(ptr %o.var), !dbg !8
|
|
// CHECK:STDOUT: ret i32 0, !dbg !11
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define weak_odr void @"_COp.49a4972657b05a86:core.Destroy.Core"(ptr %self) #0 !dbg !12 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: ret void, !dbg !18
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define weak_odr void @"_COp.93fc877b6ab5c8f9:core.Destroy.Core"(ptr %self) #0 !dbg !19 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: ret void, !dbg !22
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define weak_odr void @"_COp.6354d5454c7bf77d:core.Destroy.Core"(ptr %self) #0 !dbg !23 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: ret void, !dbg !26
|
|
// 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: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
|
|
// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; uselistorder directives
|
|
// CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: attributes #0 = { nounwind }
|
|
// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
|
|
// CHECK:STDOUT: attributes #2 = { nocallback nofree 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: "inplace_init_with_nonconst.carbon", directory: "")
|
|
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Run", linkageName: "main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
|
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
|
|
// CHECK:STDOUT: !6 = !{!7}
|
|
// CHECK:STDOUT: !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
|
|
// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 3, scope: !4)
|
|
// CHECK:STDOUT: !9 = !DILocation(line: 15, column: 3, scope: !4)
|
|
// CHECK:STDOUT: !10 = !DILocation(line: 15, column: 16, scope: !4)
|
|
// CHECK:STDOUT: !11 = !DILocation(line: 11, column: 1, scope: !4)
|
|
// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "Op", linkageName: "_COp.49a4972657b05a86:core.Destroy.Core", scope: null, file: !3, line: 15, type: !13, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !16)
|
|
// CHECK:STDOUT: !13 = !DISubroutineType(types: !14)
|
|
// CHECK:STDOUT: !14 = !{null, !15}
|
|
// CHECK:STDOUT: !15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)
|
|
// CHECK:STDOUT: !16 = !{!17}
|
|
// CHECK:STDOUT: !17 = !DILocalVariable(arg: 1, scope: !12, type: !15)
|
|
// CHECK:STDOUT: !18 = !DILocation(line: 15, column: 3, scope: !12)
|
|
// CHECK:STDOUT: !19 = distinct !DISubprogram(name: "Op", linkageName: "_COp.93fc877b6ab5c8f9:core.Destroy.Core", scope: null, file: !3, line: 15, type: !13, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !20)
|
|
// CHECK:STDOUT: !20 = !{!21}
|
|
// CHECK:STDOUT: !21 = !DILocalVariable(arg: 1, scope: !19, type: !15)
|
|
// CHECK:STDOUT: !22 = !DILocation(line: 15, column: 3, scope: !19)
|
|
// CHECK:STDOUT: !23 = distinct !DISubprogram(name: "Op", linkageName: "_COp.6354d5454c7bf77d:core.Destroy.Core", scope: null, file: !3, line: 15, type: !13, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !24)
|
|
// CHECK:STDOUT: !24 = !{!25}
|
|
// CHECK:STDOUT: !25 = !DILocalVariable(arg: 1, scope: !23, type: !15)
|
|
// CHECK:STDOUT: !26 = !DILocation(line: 15, column: 3, scope: !23)
|
|
// CHECK:STDOUT: ; ModuleID = 'implicit_init_with_nonempty_nonconst.carbon'
|
|
// CHECK:STDOUT: source_filename = "implicit_init_with_nonempty_nonconst.carbon"
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: @Other.val.loc17_40.5 = internal constant { i32 } { i32 42 }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define i32 @main() #0 !dbg !4 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: %o.var = alloca { i32 }, align 8, !dbg !8
|
|
// CHECK:STDOUT: %_.var = alloca <{ ptr, { i32 } }>, align 8, !dbg !9
|
|
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %o.var), !dbg !8
|
|
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %_.var), !dbg !9
|
|
// CHECK:STDOUT: %.loc17_40.2.a = getelementptr inbounds nuw <{ ptr, { i32 } }>, ptr %_.var, i32 0, i32 0, !dbg !10
|
|
// CHECK:STDOUT: store ptr %o.var, ptr %.loc17_40.2.a, align 8, !dbg !10
|
|
// CHECK:STDOUT: %.loc17_40.4.b = getelementptr inbounds nuw <{ ptr, { i32 } }>, ptr %_.var, i32 0, i32 1, !dbg !10
|
|
// CHECK:STDOUT: %.loc17_39.3.v = getelementptr inbounds nuw { i32 }, ptr %.loc17_40.4.b, i32 0, i32 0, !dbg !11
|
|
// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %.loc17_40.4.b, ptr align 4 @Other.val.loc17_40.5, i64 4, i1 false), !dbg !10
|
|
// CHECK:STDOUT: call void @"_COp.6354d5454c7bf77d:core.Destroy.Core"(ptr %_.var), !dbg !9
|
|
// CHECK:STDOUT: call void @"_COp.49a4972657b05a86:core.Destroy.Core"(ptr %o.var), !dbg !8
|
|
// CHECK:STDOUT: ret i32 0, !dbg !12
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define weak_odr void @"_COp.7e389eab4a7e5487:core.Destroy.Core"(ptr %self) #0 !dbg !13 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: ret void, !dbg !18
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define weak_odr void @"_COp.8e62c7e21e7d5467:core.Destroy.Core"(ptr %self) #0 !dbg !19 {
|
|
// 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.49a4972657b05a86: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: nounwind
|
|
// CHECK:STDOUT: define weak_odr void @"_COp.93fc877b6ab5c8f9:core.Destroy.Core"(ptr %self) #0 !dbg !30 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: ret void, !dbg !33
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nounwind
|
|
// CHECK:STDOUT: define weak_odr void @"_COp.6354d5454c7bf77d:core.Destroy.Core"(ptr %self) #0 !dbg !34 {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: ret void, !dbg !37
|
|
// 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: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
|
|
// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #2
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; uselistorder directives
|
|
// CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: attributes #0 = { nounwind }
|
|
// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
|
|
// CHECK:STDOUT: attributes #2 = { nocallback nofree 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: "implicit_init_with_nonempty_nonconst.carbon", directory: "")
|
|
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Run", linkageName: "main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
|
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
|
|
// CHECK:STDOUT: !6 = !{!7}
|
|
// CHECK:STDOUT: !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
|
|
// CHECK:STDOUT: !8 = !DILocation(line: 14, column: 3, scope: !4)
|
|
// CHECK:STDOUT: !9 = !DILocation(line: 17, column: 3, scope: !4)
|
|
// CHECK:STDOUT: !10 = !DILocation(line: 17, column: 16, scope: !4)
|
|
// CHECK:STDOUT: !11 = !DILocation(line: 17, column: 31, scope: !4)
|
|
// CHECK:STDOUT: !12 = !DILocation(line: 13, column: 1, scope: !4)
|
|
// CHECK:STDOUT: !13 = distinct !DISubprogram(name: "Op", linkageName: "_COp.7e389eab4a7e5487:core.Destroy.Core", scope: null, file: !3, line: 17, type: !14, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !16)
|
|
// CHECK:STDOUT: !14 = !DISubroutineType(types: !15)
|
|
// CHECK:STDOUT: !15 = !{null, !7}
|
|
// CHECK:STDOUT: !16 = !{!17}
|
|
// CHECK:STDOUT: !17 = !DILocalVariable(arg: 1, scope: !13, type: !7)
|
|
// CHECK:STDOUT: !18 = !DILocation(line: 17, column: 3, scope: !13)
|
|
// CHECK:STDOUT: !19 = distinct !DISubprogram(name: "Op", linkageName: "_COp.8e62c7e21e7d5467:core.Destroy.Core", scope: null, file: !3, line: 17, type: !20, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !23)
|
|
// CHECK:STDOUT: !20 = !DISubroutineType(types: !21)
|
|
// CHECK:STDOUT: !21 = !{null, !22}
|
|
// CHECK:STDOUT: !22 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)
|
|
// CHECK:STDOUT: !23 = !{!24}
|
|
// CHECK:STDOUT: !24 = !DILocalVariable(arg: 1, scope: !19, type: !22)
|
|
// CHECK:STDOUT: !25 = !DILocation(line: 17, column: 3, scope: !19)
|
|
// CHECK:STDOUT: !26 = distinct !DISubprogram(name: "Op", linkageName: "_COp.49a4972657b05a86:core.Destroy.Core", scope: null, file: !3, line: 17, type: !20, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !27)
|
|
// CHECK:STDOUT: !27 = !{!28}
|
|
// CHECK:STDOUT: !28 = !DILocalVariable(arg: 1, scope: !26, type: !22)
|
|
// CHECK:STDOUT: !29 = !DILocation(line: 17, column: 3, scope: !26)
|
|
// CHECK:STDOUT: !30 = distinct !DISubprogram(name: "Op", linkageName: "_COp.93fc877b6ab5c8f9:core.Destroy.Core", scope: null, file: !3, line: 17, type: !20, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !31)
|
|
// CHECK:STDOUT: !31 = !{!32}
|
|
// CHECK:STDOUT: !32 = !DILocalVariable(arg: 1, scope: !30, type: !22)
|
|
// CHECK:STDOUT: !33 = !DILocation(line: 17, column: 3, scope: !30)
|
|
// CHECK:STDOUT: !34 = distinct !DISubprogram(name: "Op", linkageName: "_COp.6354d5454c7bf77d:core.Destroy.Core", scope: null, file: !3, line: 17, type: !20, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !35)
|
|
// CHECK:STDOUT: !35 = !{!36}
|
|
// CHECK:STDOUT: !36 = !DILocalVariable(arg: 1, scope: !34, type: !22)
|
|
// CHECK:STDOUT: !37 = !DILocation(line: 17, column: 3, scope: !34)
|