multifile_raw_ir.carbon 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 --phase=check --dump-raw-sem-ir %s
  6. //
  7. // Check that raw IR dumping works as expected.
  8. //
  9. // AUTOUPDATE
  10. // --- a.carbon
  11. package A api;
  12. fn A() {}
  13. // --- b.carbon
  14. package B api;
  15. fn B() {}
  16. // CHECK:STDOUT: ---
  17. // CHECK:STDOUT: filename: a.carbon
  18. // CHECK:STDOUT: sem_ir:
  19. // CHECK:STDOUT: import_irs_size: 1
  20. // CHECK:STDOUT: name_scopes:
  21. // CHECK:STDOUT: name_scope0: {inst: inst+0, enclosing_scope: name_scope<invalid>, has_error: false, extended_scopes: [], names: {name0: inst+1}}
  22. // CHECK:STDOUT: bind_names: {}
  23. // CHECK:STDOUT: functions:
  24. // CHECK:STDOUT: function0: {name: name0, enclosing_scope: name_scope0, param_refs: empty, body: [block3]}
  25. // CHECK:STDOUT: classes: {}
  26. // CHECK:STDOUT: types:
  27. // CHECK:STDOUT: type0: {constant: template instNamespaceType, value_rep: {kind: copy, type: type0}}
  28. // CHECK:STDOUT: type1: {constant: template instFunctionType, value_rep: {kind: copy, type: type1}}
  29. // CHECK:STDOUT: type_blocks: {}
  30. // CHECK:STDOUT: insts:
  31. // CHECK:STDOUT: inst+0: {kind: Namespace, arg0: name_scope0, arg1: inst<invalid>, type: type0}
  32. // CHECK:STDOUT: inst+1: {kind: FunctionDecl, arg0: function0, arg1: empty, type: type1}
  33. // CHECK:STDOUT: inst+2: {kind: Return}
  34. // CHECK:STDOUT: constant_values:
  35. // CHECK:STDOUT: inst+0: template inst+0
  36. // CHECK:STDOUT: inst+1: template inst+1
  37. // CHECK:STDOUT: inst_blocks:
  38. // CHECK:STDOUT: empty: {}
  39. // CHECK:STDOUT: exports:
  40. // CHECK:STDOUT: 0: inst+1
  41. // CHECK:STDOUT: global_init: {}
  42. // CHECK:STDOUT: block3:
  43. // CHECK:STDOUT: 0: inst+2
  44. // CHECK:STDOUT: block4:
  45. // CHECK:STDOUT: 0: inst+0
  46. // CHECK:STDOUT: 1: inst+1
  47. // CHECK:STDOUT: ...
  48. // CHECK:STDOUT: ---
  49. // CHECK:STDOUT: filename: b.carbon
  50. // CHECK:STDOUT: sem_ir:
  51. // CHECK:STDOUT: import_irs_size: 1
  52. // CHECK:STDOUT: name_scopes:
  53. // CHECK:STDOUT: name_scope0: {inst: inst+0, enclosing_scope: name_scope<invalid>, has_error: false, extended_scopes: [], names: {name0: inst+1}}
  54. // CHECK:STDOUT: bind_names: {}
  55. // CHECK:STDOUT: functions:
  56. // CHECK:STDOUT: function0: {name: name0, enclosing_scope: name_scope0, param_refs: empty, body: [block3]}
  57. // CHECK:STDOUT: classes: {}
  58. // CHECK:STDOUT: types:
  59. // CHECK:STDOUT: type0: {constant: template instNamespaceType, value_rep: {kind: copy, type: type0}}
  60. // CHECK:STDOUT: type1: {constant: template instFunctionType, value_rep: {kind: copy, type: type1}}
  61. // CHECK:STDOUT: type_blocks: {}
  62. // CHECK:STDOUT: insts:
  63. // CHECK:STDOUT: inst+0: {kind: Namespace, arg0: name_scope0, arg1: inst<invalid>, type: type0}
  64. // CHECK:STDOUT: inst+1: {kind: FunctionDecl, arg0: function0, arg1: empty, type: type1}
  65. // CHECK:STDOUT: inst+2: {kind: Return}
  66. // CHECK:STDOUT: constant_values:
  67. // CHECK:STDOUT: inst+0: template inst+0
  68. // CHECK:STDOUT: inst+1: template inst+1
  69. // CHECK:STDOUT: inst_blocks:
  70. // CHECK:STDOUT: empty: {}
  71. // CHECK:STDOUT: exports:
  72. // CHECK:STDOUT: 0: inst+1
  73. // CHECK:STDOUT: global_init: {}
  74. // CHECK:STDOUT: block3:
  75. // CHECK:STDOUT: 0: inst+2
  76. // CHECK:STDOUT: block4:
  77. // CHECK:STDOUT: 0: inst+0
  78. // CHECK:STDOUT: 1: inst+1
  79. // CHECK:STDOUT: ...