multifile_raw_and_textual_ir.carbon 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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: cross_ref_irs_size: 1
  20. // CHECK:STDOUT: functions:
  21. // CHECK:STDOUT: function0: {name: name0, param_refs: block0, body: [block1]}
  22. // CHECK:STDOUT: classes: {}
  23. // CHECK:STDOUT: types:
  24. // CHECK:STDOUT: type0: {inst: instNamespaceType, value_rep: {kind: copy, type: type0}}
  25. // CHECK:STDOUT: type1: {inst: instFunctionType, value_rep: {kind: copy, type: type1}}
  26. // CHECK:STDOUT: type_blocks: {}
  27. // CHECK:STDOUT: insts:
  28. // CHECK:STDOUT: inst+0: {kind: Namespace, arg0: name_scope0, type: type0}
  29. // CHECK:STDOUT: inst+1: {kind: FunctionDecl, arg0: function0, type: type1}
  30. // CHECK:STDOUT: inst+2: {kind: Return}
  31. // CHECK:STDOUT: inst_blocks:
  32. // CHECK:STDOUT: block0: {}
  33. // CHECK:STDOUT: block1:
  34. // CHECK:STDOUT: 0: inst+2
  35. // CHECK:STDOUT: block2:
  36. // CHECK:STDOUT: 0: inst+0
  37. // CHECK:STDOUT: 1: inst+1
  38. // CHECK:STDOUT: ...
  39. // CHECK:STDOUT:
  40. // CHECK:STDOUT: --- a.carbon
  41. // CHECK:STDOUT:
  42. // CHECK:STDOUT: file {
  43. // CHECK:STDOUT: package: <namespace> = namespace {.A = %A}
  44. // CHECK:STDOUT: %A: <function> = fn_decl @A
  45. // CHECK:STDOUT: }
  46. // CHECK:STDOUT:
  47. // CHECK:STDOUT: fn @A() {
  48. // CHECK:STDOUT: !entry:
  49. // CHECK:STDOUT: return
  50. // CHECK:STDOUT: }
  51. // CHECK:STDOUT:
  52. // CHECK:STDOUT: ---
  53. // CHECK:STDOUT: filename: b.carbon
  54. // CHECK:STDOUT: sem_ir:
  55. // CHECK:STDOUT: cross_ref_irs_size: 1
  56. // CHECK:STDOUT: functions:
  57. // CHECK:STDOUT: function0: {name: name0, param_refs: block0, body: [block1]}
  58. // CHECK:STDOUT: classes: {}
  59. // CHECK:STDOUT: types:
  60. // CHECK:STDOUT: type0: {inst: instNamespaceType, value_rep: {kind: copy, type: type0}}
  61. // CHECK:STDOUT: type1: {inst: instFunctionType, value_rep: {kind: copy, type: type1}}
  62. // CHECK:STDOUT: type_blocks: {}
  63. // CHECK:STDOUT: insts:
  64. // CHECK:STDOUT: inst+0: {kind: Namespace, arg0: name_scope0, type: type0}
  65. // CHECK:STDOUT: inst+1: {kind: FunctionDecl, arg0: function0, type: type1}
  66. // CHECK:STDOUT: inst+2: {kind: Return}
  67. // CHECK:STDOUT: inst_blocks:
  68. // CHECK:STDOUT: block0: {}
  69. // CHECK:STDOUT: block1:
  70. // CHECK:STDOUT: 0: inst+2
  71. // CHECK:STDOUT: block2:
  72. // CHECK:STDOUT: 0: inst+0
  73. // CHECK:STDOUT: 1: inst+1
  74. // CHECK:STDOUT: ...
  75. // CHECK:STDOUT:
  76. // CHECK:STDOUT: --- b.carbon
  77. // CHECK:STDOUT:
  78. // CHECK:STDOUT: file {
  79. // CHECK:STDOUT: package: <namespace> = namespace {.B = %B}
  80. // CHECK:STDOUT: %B: <function> = fn_decl @B
  81. // CHECK:STDOUT: }
  82. // CHECK:STDOUT:
  83. // CHECK:STDOUT: fn @B() {
  84. // CHECK:STDOUT: !entry:
  85. // CHECK:STDOUT: return
  86. // CHECK:STDOUT: }
  87. // CHECK:STDOUT: