multifile_raw_ir.carbon 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. // ARGS: compile --no-prelude-import --phase=check --dump-raw-sem-ir %s
  6. //
  7. // Check that raw IR dumping works as expected.
  8. //
  9. // AUTOUPDATE
  10. // TIP: To test this file alone, run:
  11. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/no_prelude/multifile_raw_ir.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/no_prelude/multifile_raw_ir.carbon
  14. // --- a.carbon
  15. package A;
  16. fn A() {}
  17. // --- b.carbon
  18. package B;
  19. fn B() {}
  20. // CHECK:STDOUT: ---
  21. // CHECK:STDOUT: filename: a.carbon
  22. // CHECK:STDOUT: sem_ir:
  23. // CHECK:STDOUT: import_irs_size: 1
  24. // CHECK:STDOUT: name_scopes:
  25. // CHECK:STDOUT: name_scope0: {inst: inst+0, parent_scope: name_scope<invalid>, has_error: false, extended_scopes: [], names: {name0: inst+1}}
  26. // CHECK:STDOUT: bind_names: {}
  27. // CHECK:STDOUT: functions:
  28. // CHECK:STDOUT: function0: {name: name0, parent_scope: name_scope0, param_refs: empty, body: [block3]}
  29. // CHECK:STDOUT: classes: {}
  30. // CHECK:STDOUT: generics: {}
  31. // CHECK:STDOUT: generic_instances: {}
  32. // CHECK:STDOUT: types:
  33. // CHECK:STDOUT: type0: {constant: template instNamespaceType, value_rep: {kind: copy, type: type0}}
  34. // CHECK:STDOUT: type1: {constant: template inst+2, value_rep: {kind: none, type: type2}}
  35. // CHECK:STDOUT: type2: {constant: template inst+3, value_rep: {kind: none, type: type2}}
  36. // CHECK:STDOUT: type_blocks:
  37. // CHECK:STDOUT: typeBlock0: {}
  38. // CHECK:STDOUT: insts:
  39. // CHECK:STDOUT: 'inst+0': {kind: Namespace, arg0: name_scope0, arg1: inst<invalid>, type: type0}
  40. // CHECK:STDOUT: 'inst+1': {kind: FunctionDecl, arg0: function0, arg1: empty, type: type1}
  41. // CHECK:STDOUT: 'inst+2': {kind: FunctionType, arg0: function0, type: typeTypeType}
  42. // CHECK:STDOUT: 'inst+3': {kind: TupleType, arg0: typeBlock0, type: typeTypeType}
  43. // CHECK:STDOUT: 'inst+4': {kind: StructValue, arg0: empty, type: type1}
  44. // CHECK:STDOUT: 'inst+5': {kind: Return}
  45. // CHECK:STDOUT: constant_values:
  46. // CHECK:STDOUT: 'inst+0': template inst+0
  47. // CHECK:STDOUT: 'inst+1': template inst+4
  48. // CHECK:STDOUT: 'inst+2': template inst+2
  49. // CHECK:STDOUT: 'inst+3': template inst+3
  50. // CHECK:STDOUT: 'inst+4': template inst+4
  51. // CHECK:STDOUT: inst_blocks:
  52. // CHECK:STDOUT: empty: {}
  53. // CHECK:STDOUT: exports:
  54. // CHECK:STDOUT: 0: inst+1
  55. // CHECK:STDOUT: global_init: {}
  56. // CHECK:STDOUT: block3:
  57. // CHECK:STDOUT: 0: inst+5
  58. // CHECK:STDOUT: block4:
  59. // CHECK:STDOUT: 0: inst+0
  60. // CHECK:STDOUT: 1: inst+1
  61. // CHECK:STDOUT: ...
  62. // CHECK:STDOUT: ---
  63. // CHECK:STDOUT: filename: b.carbon
  64. // CHECK:STDOUT: sem_ir:
  65. // CHECK:STDOUT: import_irs_size: 1
  66. // CHECK:STDOUT: name_scopes:
  67. // CHECK:STDOUT: name_scope0: {inst: inst+0, parent_scope: name_scope<invalid>, has_error: false, extended_scopes: [], names: {name0: inst+1}}
  68. // CHECK:STDOUT: bind_names: {}
  69. // CHECK:STDOUT: functions:
  70. // CHECK:STDOUT: function0: {name: name0, parent_scope: name_scope0, param_refs: empty, body: [block3]}
  71. // CHECK:STDOUT: classes: {}
  72. // CHECK:STDOUT: generics: {}
  73. // CHECK:STDOUT: generic_instances: {}
  74. // CHECK:STDOUT: types:
  75. // CHECK:STDOUT: type0: {constant: template instNamespaceType, value_rep: {kind: copy, type: type0}}
  76. // CHECK:STDOUT: type1: {constant: template inst+2, value_rep: {kind: none, type: type2}}
  77. // CHECK:STDOUT: type2: {constant: template inst+3, value_rep: {kind: none, type: type2}}
  78. // CHECK:STDOUT: type_blocks:
  79. // CHECK:STDOUT: typeBlock0: {}
  80. // CHECK:STDOUT: insts:
  81. // CHECK:STDOUT: 'inst+0': {kind: Namespace, arg0: name_scope0, arg1: inst<invalid>, type: type0}
  82. // CHECK:STDOUT: 'inst+1': {kind: FunctionDecl, arg0: function0, arg1: empty, type: type1}
  83. // CHECK:STDOUT: 'inst+2': {kind: FunctionType, arg0: function0, type: typeTypeType}
  84. // CHECK:STDOUT: 'inst+3': {kind: TupleType, arg0: typeBlock0, type: typeTypeType}
  85. // CHECK:STDOUT: 'inst+4': {kind: StructValue, arg0: empty, type: type1}
  86. // CHECK:STDOUT: 'inst+5': {kind: Return}
  87. // CHECK:STDOUT: constant_values:
  88. // CHECK:STDOUT: 'inst+0': template inst+0
  89. // CHECK:STDOUT: 'inst+1': template inst+4
  90. // CHECK:STDOUT: 'inst+2': template inst+2
  91. // CHECK:STDOUT: 'inst+3': template inst+3
  92. // CHECK:STDOUT: 'inst+4': template inst+4
  93. // CHECK:STDOUT: inst_blocks:
  94. // CHECK:STDOUT: empty: {}
  95. // CHECK:STDOUT: exports:
  96. // CHECK:STDOUT: 0: inst+1
  97. // CHECK:STDOUT: global_init: {}
  98. // CHECK:STDOUT: block3:
  99. // CHECK:STDOUT: 0: inst+5
  100. // CHECK:STDOUT: block4:
  101. // CHECK:STDOUT: 0: inst+0
  102. // CHECK:STDOUT: 1: inst+1
  103. // CHECK:STDOUT: ...