| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
- // Exceptions. See /LICENSE for license information.
- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- //
- // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon
- // EXTRA-ARGS: --dump-raw-sem-ir --no-dump-sem-ir
- //
- // Check that raw IR dumping works as expected.
- //
- // AUTOUPDATE
- // TIP: To test this file alone, run:
- // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/raw_sem_ir/multifile.carbon
- // TIP: To dump output, run:
- // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/raw_sem_ir/multifile.carbon
- // --- a.carbon
- package A;
- fn A() {}
- // --- b.carbon
- package B;
- import A;
- fn B() {
- A.A();
- }
- // CHECK:STDOUT: ---
- // CHECK:STDOUT: filename: a.carbon
- // CHECK:STDOUT: sem_ir:
- // CHECK:STDOUT: import_irs:
- // CHECK:STDOUT: ir0: {decl_id: inst<none>, is_export: false}
- // CHECK:STDOUT: ir1: {decl_id: inst<none>, is_export: false}
- // CHECK:STDOUT: import_ir_insts: {}
- // CHECK:STDOUT: clang_decls: {}
- // CHECK:STDOUT: name_scopes:
- // CHECK:STDOUT: name_scope0: {inst: inst14, parent_scope: name_scope<none>, has_error: false, extended_scopes: [], names: {name0: ir0.inst15}}
- // CHECK:STDOUT: entity_names: {}
- // CHECK:STDOUT: functions:
- // CHECK:STDOUT: function0: {name: name0, parent_scope: name_scope0, call_params_id: inst_block_empty, body: [inst_block5]}
- // CHECK:STDOUT: classes: {}
- // CHECK:STDOUT: generics: {}
- // CHECK:STDOUT: specifics: {}
- // CHECK:STDOUT: struct_type_fields:
- // CHECK:STDOUT: struct_type_fields0: {}
- // CHECK:STDOUT: types:
- // CHECK:STDOUT: 'type(TypeType)':
- // CHECK:STDOUT: value_repr: {kind: copy, type: type(TypeType)}
- // CHECK:STDOUT: 'type(Error)':
- // CHECK:STDOUT: value_repr: {kind: copy, type: type(Error)}
- // CHECK:STDOUT: 'type(inst(NamespaceType))':
- // CHECK:STDOUT: value_repr: {kind: copy, type: type(inst(NamespaceType))}
- // CHECK:STDOUT: 'type(ir0.inst16)':
- // CHECK:STDOUT: value_repr: {kind: none, type: type(ir0.inst17)}
- // CHECK:STDOUT: 'type(ir0.inst17)':
- // CHECK:STDOUT: value_repr: {kind: none, type: type(ir0.inst17)}
- // CHECK:STDOUT: insts:
- // CHECK:STDOUT: inst14: {kind: Namespace, arg0: name_scope0, arg1: inst<none>, type: type(inst(NamespaceType))}
- // CHECK:STDOUT: ir0.inst15: {kind: FunctionDecl, arg0: function0, arg1: inst_block_empty, type: type(ir0.inst16)}
- // CHECK:STDOUT: ir0.inst16: {kind: FunctionType, arg0: function0, arg1: specific<none>, type: type(TypeType)}
- // CHECK:STDOUT: ir0.inst17: {kind: TupleType, arg0: inst_block_empty, type: type(TypeType)}
- // CHECK:STDOUT: ir0.inst18: {kind: StructValue, arg0: inst_block_empty, type: type(ir0.inst16)}
- // CHECK:STDOUT: ir0.inst19: {kind: Return}
- // CHECK:STDOUT: constant_values:
- // CHECK:STDOUT: values:
- // CHECK:STDOUT: inst14: concrete_constant(inst14)
- // CHECK:STDOUT: ir0.inst15: concrete_constant(ir0.inst18)
- // CHECK:STDOUT: ir0.inst16: concrete_constant(ir0.inst16)
- // CHECK:STDOUT: ir0.inst17: concrete_constant(ir0.inst17)
- // CHECK:STDOUT: ir0.inst18: concrete_constant(ir0.inst18)
- // CHECK:STDOUT: symbolic_constants: {}
- // CHECK:STDOUT: inst_blocks:
- // CHECK:STDOUT: inst_block_empty: {}
- // CHECK:STDOUT: exports:
- // CHECK:STDOUT: 0: ir0.inst15
- // CHECK:STDOUT: imports: {}
- // CHECK:STDOUT: global_init: {}
- // CHECK:STDOUT: inst_block4: {}
- // CHECK:STDOUT: inst_block5:
- // CHECK:STDOUT: 0: ir0.inst19
- // CHECK:STDOUT: inst_block6:
- // CHECK:STDOUT: 0: inst14
- // CHECK:STDOUT: 1: ir0.inst15
- // CHECK:STDOUT: ...
- // CHECK:STDOUT: ---
- // CHECK:STDOUT: filename: b.carbon
- // CHECK:STDOUT: sem_ir:
- // CHECK:STDOUT: import_irs:
- // CHECK:STDOUT: ir0: {decl_id: inst<none>, is_export: false}
- // CHECK:STDOUT: ir1: {decl_id: inst<none>, is_export: false}
- // CHECK:STDOUT: ir2: {decl_id: ir1.inst15, is_export: false}
- // CHECK:STDOUT: import_ir_insts:
- // CHECK:STDOUT: import_ir_inst0: {ir_id: ir2, inst_id: ir0.inst15}
- // CHECK:STDOUT: import_ir_inst1: {ir_id: ir2, inst_id: ir0.inst15}
- // CHECK:STDOUT: clang_decls: {}
- // CHECK:STDOUT: name_scopes:
- // CHECK:STDOUT: name_scope0: {inst: inst14, parent_scope: name_scope<none>, has_error: false, extended_scopes: [], names: {name1: ir1.inst16, name0: ir1.inst17}}
- // CHECK:STDOUT: name_scope1: {inst: ir1.inst16, parent_scope: name_scope0, has_error: false, extended_scopes: [], names: {name1: ir1.inst22}}
- // CHECK:STDOUT: entity_names:
- // CHECK:STDOUT: entity_name0: {name: name1, parent_scope: name_scope1, index: -1, is_template: 0, clang_decl_id: clang_decl_id<none>}
- // CHECK:STDOUT: functions:
- // CHECK:STDOUT: function0: {name: name0, parent_scope: name_scope0, call_params_id: inst_block_empty, body: [inst_block5]}
- // CHECK:STDOUT: function1: {name: name1, parent_scope: name_scope1}
- // CHECK:STDOUT: classes: {}
- // CHECK:STDOUT: generics: {}
- // CHECK:STDOUT: specifics: {}
- // CHECK:STDOUT: struct_type_fields:
- // CHECK:STDOUT: struct_type_fields0: {}
- // CHECK:STDOUT: types:
- // CHECK:STDOUT: 'type(TypeType)':
- // CHECK:STDOUT: value_repr: {kind: copy, type: type(TypeType)}
- // CHECK:STDOUT: 'type(Error)':
- // CHECK:STDOUT: value_repr: {kind: copy, type: type(Error)}
- // CHECK:STDOUT: 'type(inst(NamespaceType))':
- // CHECK:STDOUT: value_repr: {kind: copy, type: type(inst(NamespaceType))}
- // CHECK:STDOUT: 'type(ir1.inst18)':
- // CHECK:STDOUT: value_repr: {kind: none, type: type(ir1.inst19)}
- // CHECK:STDOUT: 'type(ir1.inst19)':
- // CHECK:STDOUT: value_repr: {kind: none, type: type(ir1.inst19)}
- // CHECK:STDOUT: insts:
- // CHECK:STDOUT: inst14: {kind: Namespace, arg0: name_scope0, arg1: inst<none>, type: type(inst(NamespaceType))}
- // CHECK:STDOUT: ir1.inst15: {kind: ImportDecl, arg0: name1}
- // CHECK:STDOUT: ir1.inst16: {kind: Namespace, arg0: name_scope1, arg1: ir1.inst15, type: type(inst(NamespaceType))}
- // CHECK:STDOUT: ir1.inst17: {kind: FunctionDecl, arg0: function0, arg1: inst_block_empty, type: type(ir1.inst18)}
- // CHECK:STDOUT: ir1.inst18: {kind: FunctionType, arg0: function0, arg1: specific<none>, type: type(TypeType)}
- // CHECK:STDOUT: ir1.inst19: {kind: TupleType, arg0: inst_block_empty, type: type(TypeType)}
- // CHECK:STDOUT: ir1.inst20: {kind: StructValue, arg0: inst_block_empty, type: type(ir1.inst18)}
- // CHECK:STDOUT: ir1.inst21: {kind: NameRef, arg0: name1, arg1: ir1.inst16, type: type(inst(NamespaceType))}
- // CHECK:STDOUT: ir1.inst22: {kind: ImportRefLoaded, arg0: import_ir_inst0, arg1: entity_name0, type: type(ir1.inst24)}
- // CHECK:STDOUT: ir1.inst23: {kind: FunctionDecl, arg0: function1, arg1: inst_block_empty, type: type(ir1.inst24)}
- // CHECK:STDOUT: ir1.inst24: {kind: FunctionType, arg0: function1, arg1: specific<none>, type: type(TypeType)}
- // CHECK:STDOUT: ir1.inst25: {kind: StructValue, arg0: inst_block_empty, type: type(ir1.inst24)}
- // CHECK:STDOUT: ir1.inst26: {kind: NameRef, arg0: name1, arg1: ir1.inst22, type: type(ir1.inst24)}
- // CHECK:STDOUT: ir1.inst27: {kind: Call, arg0: ir1.inst26, arg1: inst_block_empty, type: type(ir1.inst19)}
- // CHECK:STDOUT: ir1.inst28: {kind: Return}
- // CHECK:STDOUT: constant_values:
- // CHECK:STDOUT: values:
- // CHECK:STDOUT: inst14: concrete_constant(inst14)
- // CHECK:STDOUT: ir1.inst16: concrete_constant(ir1.inst16)
- // CHECK:STDOUT: ir1.inst17: concrete_constant(ir1.inst20)
- // CHECK:STDOUT: ir1.inst18: concrete_constant(ir1.inst18)
- // CHECK:STDOUT: ir1.inst19: concrete_constant(ir1.inst19)
- // CHECK:STDOUT: ir1.inst20: concrete_constant(ir1.inst20)
- // CHECK:STDOUT: ir1.inst21: concrete_constant(ir1.inst16)
- // CHECK:STDOUT: ir1.inst22: concrete_constant(ir1.inst25)
- // CHECK:STDOUT: ir1.inst23: concrete_constant(ir1.inst25)
- // CHECK:STDOUT: ir1.inst24: concrete_constant(ir1.inst24)
- // CHECK:STDOUT: ir1.inst25: concrete_constant(ir1.inst25)
- // CHECK:STDOUT: ir1.inst26: concrete_constant(ir1.inst25)
- // CHECK:STDOUT: symbolic_constants: {}
- // CHECK:STDOUT: inst_blocks:
- // CHECK:STDOUT: inst_block_empty: {}
- // CHECK:STDOUT: exports:
- // CHECK:STDOUT: 0: ir1.inst17
- // CHECK:STDOUT: imports:
- // CHECK:STDOUT: 0: ir1.inst16
- // CHECK:STDOUT: 1: ir1.inst22
- // CHECK:STDOUT: 2: ir1.inst23
- // CHECK:STDOUT: global_init: {}
- // CHECK:STDOUT: inst_block4: {}
- // CHECK:STDOUT: inst_block5:
- // CHECK:STDOUT: 0: ir1.inst21
- // CHECK:STDOUT: 1: ir1.inst26
- // CHECK:STDOUT: 2: ir1.inst27
- // CHECK:STDOUT: 3: ir1.inst28
- // CHECK:STDOUT: inst_block6:
- // CHECK:STDOUT: 0: inst14
- // CHECK:STDOUT: 1: ir1.inst15
- // CHECK:STDOUT: 2: ir1.inst17
- // CHECK:STDOUT: ...
|