class_obj.carbon 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/convert.carbon
  6. //
  7. // AUTOUPDATE
  8. // TIP: To test this file alone, run:
  9. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/global/class_obj.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/global/class_obj.carbon
  12. class A {}
  13. var a: A = {};
  14. // CHECK:STDOUT: ; ModuleID = 'class_obj.carbon'
  15. // CHECK:STDOUT: source_filename = "class_obj.carbon"
  16. // CHECK:STDOUT:
  17. // CHECK:STDOUT: @_Ca.Main = global {} zeroinitializer
  18. // CHECK:STDOUT: @A.val.loc14_1 = internal constant {} zeroinitializer
  19. // CHECK:STDOUT: @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @_C__global_init.Main, ptr null }]
  20. // CHECK:STDOUT:
  21. // CHECK:STDOUT: ; Function Attrs: nounwind
  22. // CHECK:STDOUT: define internal void @_C__global_init.Main() #0 !dbg !4 {
  23. // CHECK:STDOUT: entry:
  24. // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 @_Ca.Main, ptr align 1 @A.val.loc14_1, i64 0, i1 false), !dbg !7
  25. // CHECK:STDOUT: ret void, !dbg !8
  26. // CHECK:STDOUT: }
  27. // CHECK:STDOUT:
  28. // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
  29. // CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1
  30. // CHECK:STDOUT:
  31. // CHECK:STDOUT: attributes #0 = { nounwind }
  32. // CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
  33. // CHECK:STDOUT:
  34. // CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
  35. // CHECK:STDOUT: !llvm.dbg.cu = !{!2}
  36. // CHECK:STDOUT:
  37. // CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
  38. // CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
  39. // CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
  40. // CHECK:STDOUT: !3 = !DIFile(filename: "class_obj.carbon", directory: "")
  41. // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "__global_init", linkageName: "_C__global_init.Main", scope: null, file: !3, type: !5, spFlags: DISPFlagDefinition, unit: !2)
  42. // CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
  43. // CHECK:STDOUT: !6 = !{null}
  44. // CHECK:STDOUT: !7 = !DILocation(line: 14, column: 1, scope: !4)
  45. // CHECK:STDOUT: !8 = !DILocation(line: 0, scope: !4)