struct_param.carbon 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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/int.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/function/call/struct_param.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/function/call/struct_param.carbon
  12. fn F(_: {}, _: {.a: i32}, _: {.a: i32, .b: i32}) {}
  13. fn Main() {
  14. F({}, {.a = 1}, {.a = 2, .b = 3});
  15. }
  16. // CHECK:STDOUT: ; ModuleID = 'struct_param.carbon'
  17. // CHECK:STDOUT: source_filename = "struct_param.carbon"
  18. // CHECK:STDOUT:
  19. // CHECK:STDOUT: @struct.9ae.loc16_34.6 = internal constant { i32, i32 } { i32 2, i32 3 }
  20. // CHECK:STDOUT:
  21. // CHECK:STDOUT: ; Function Attrs: nounwind
  22. // CHECK:STDOUT: define void @_CF.Main({ i32 } %_, ptr %_1) #0 !dbg !4 {
  23. // CHECK:STDOUT: entry:
  24. // CHECK:STDOUT: ret void, !dbg !11
  25. // CHECK:STDOUT: }
  26. // CHECK:STDOUT:
  27. // CHECK:STDOUT: ; Function Attrs: nounwind
  28. // CHECK:STDOUT: define void @_CMain.Main() #0 !dbg !12 {
  29. // CHECK:STDOUT: entry:
  30. // CHECK:STDOUT: call void @_CF.Main({ i32 } { i32 1 }, ptr @struct.9ae.loc16_34.6), !dbg !15
  31. // CHECK:STDOUT: ret void, !dbg !16
  32. // CHECK:STDOUT: }
  33. // CHECK:STDOUT:
  34. // CHECK:STDOUT: attributes #0 = { nounwind }
  35. // CHECK:STDOUT:
  36. // CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
  37. // CHECK:STDOUT: !llvm.dbg.cu = !{!2}
  38. // CHECK:STDOUT:
  39. // CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
  40. // CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
  41. // CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
  42. // CHECK:STDOUT: !3 = !DIFile(filename: "struct_param.carbon", directory: "")
  43. // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", linkageName: "_CF.Main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !8)
  44. // CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
  45. // CHECK:STDOUT: !6 = !{null, !7, !7}
  46. // CHECK:STDOUT: !7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 8)
  47. // CHECK:STDOUT: !8 = !{!9, !10}
  48. // CHECK:STDOUT: !9 = !DILocalVariable(arg: 1, scope: !4, type: !7)
  49. // CHECK:STDOUT: !10 = !DILocalVariable(arg: 2, scope: !4, type: !7)
  50. // CHECK:STDOUT: !11 = !DILocation(line: 13, column: 1, scope: !4)
  51. // CHECK:STDOUT: !12 = distinct !DISubprogram(name: "Main", linkageName: "_CMain.Main", scope: null, file: !3, line: 15, type: !13, spFlags: DISPFlagDefinition, unit: !2)
  52. // CHECK:STDOUT: !13 = !DISubroutineType(types: !14)
  53. // CHECK:STDOUT: !14 = !{null}
  54. // CHECK:STDOUT: !15 = !DILocation(line: 16, column: 3, scope: !12)
  55. // CHECK:STDOUT: !16 = !DILocation(line: 15, column: 1, scope: !12)