multifile_raw_and_textual_ir.carbon 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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-sem-ir --dump-raw-sem-ir %s
  6. //
  7. // Check that we can combine textual IR and raw IR dumping in one compile.
  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: --- a.carbon
  50. // CHECK:STDOUT:
  51. // CHECK:STDOUT: file {
  52. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  53. // CHECK:STDOUT: .A = %A
  54. // CHECK:STDOUT: }
  55. // CHECK:STDOUT: %A: <function> = fn_decl @A [template] {}
  56. // CHECK:STDOUT: }
  57. // CHECK:STDOUT:
  58. // CHECK:STDOUT: fn @A() {
  59. // CHECK:STDOUT: !entry:
  60. // CHECK:STDOUT: return
  61. // CHECK:STDOUT: }
  62. // CHECK:STDOUT:
  63. // CHECK:STDOUT: ---
  64. // CHECK:STDOUT: filename: b.carbon
  65. // CHECK:STDOUT: sem_ir:
  66. // CHECK:STDOUT: import_irs_size: 1
  67. // CHECK:STDOUT: name_scopes:
  68. // CHECK:STDOUT: name_scope0: {inst: inst+0, enclosing_scope: name_scope<invalid>, has_error: false, extended_scopes: [], names: {name0: inst+1}}
  69. // CHECK:STDOUT: bind_names: {}
  70. // CHECK:STDOUT: functions:
  71. // CHECK:STDOUT: function0: {name: name0, enclosing_scope: name_scope0, param_refs: empty, body: [block3]}
  72. // CHECK:STDOUT: classes: {}
  73. // CHECK:STDOUT: types:
  74. // CHECK:STDOUT: type0: {constant: template instNamespaceType, value_rep: {kind: copy, type: type0}}
  75. // CHECK:STDOUT: type1: {constant: template instFunctionType, value_rep: {kind: copy, type: type1}}
  76. // CHECK:STDOUT: type_blocks: {}
  77. // CHECK:STDOUT: insts:
  78. // CHECK:STDOUT: inst+0: {kind: Namespace, arg0: name_scope0, arg1: inst<invalid>, type: type0}
  79. // CHECK:STDOUT: inst+1: {kind: FunctionDecl, arg0: function0, arg1: empty, type: type1}
  80. // CHECK:STDOUT: inst+2: {kind: Return}
  81. // CHECK:STDOUT: constant_values:
  82. // CHECK:STDOUT: inst+0: template inst+0
  83. // CHECK:STDOUT: inst+1: template inst+1
  84. // CHECK:STDOUT: inst_blocks:
  85. // CHECK:STDOUT: empty: {}
  86. // CHECK:STDOUT: exports:
  87. // CHECK:STDOUT: 0: inst+1
  88. // CHECK:STDOUT: global_init: {}
  89. // CHECK:STDOUT: block3:
  90. // CHECK:STDOUT: 0: inst+2
  91. // CHECK:STDOUT: block4:
  92. // CHECK:STDOUT: 0: inst+0
  93. // CHECK:STDOUT: 1: inst+1
  94. // CHECK:STDOUT: ...
  95. // CHECK:STDOUT:
  96. // CHECK:STDOUT: --- b.carbon
  97. // CHECK:STDOUT:
  98. // CHECK:STDOUT: file {
  99. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  100. // CHECK:STDOUT: .B = %B
  101. // CHECK:STDOUT: }
  102. // CHECK:STDOUT: %B: <function> = fn_decl @B [template] {}
  103. // CHECK:STDOUT: }
  104. // CHECK:STDOUT:
  105. // CHECK:STDOUT: fn @B() {
  106. // CHECK:STDOUT: !entry:
  107. // CHECK:STDOUT: return
  108. // CHECK:STDOUT: }
  109. // CHECK:STDOUT: