| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 |
- // 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: names:
- // CHECK:STDOUT: name0: A
- // CHECK:STDOUT: import_irs:
- // CHECK:STDOUT: 'import_ir(ApiForImpl)': {decl_id: inst<none>, is_export: false}
- // CHECK:STDOUT: 'import_ir(Cpp)': {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: instF, parent_scope: name_scope<none>, has_error: false, extended_scopes: [], names: {name0: inst50000010}}
- // CHECK:STDOUT: entity_names: {}
- // CHECK:STDOUT: cpp_global_vars: {}
- // CHECK:STDOUT: functions:
- // CHECK:STDOUT: function50000000: {name: name0, parent_scope: name_scope0, call_param_patterns_id: inst_block_empty, call_params_id: inst_block_empty, body: [inst_block50000006]}
- // CHECK:STDOUT: classes: {}
- // CHECK:STDOUT: interfaces: {}
- // CHECK:STDOUT: associated_constants: {}
- // CHECK:STDOUT: impls: {}
- // CHECK:STDOUT: generics: {}
- // CHECK:STDOUT: specifics: {}
- // CHECK:STDOUT: specific_interfaces: {}
- // CHECK:STDOUT: struct_type_fields:
- // CHECK:STDOUT: struct_type_fields_empty: {}
- // CHECK:STDOUT: types:
- // CHECK:STDOUT: 'type(TypeType)':
- // CHECK:STDOUT: value_repr: {kind: copy, type: type(TypeType)}
- // CHECK:STDOUT: 'type(inst(FormType))':
- // CHECK:STDOUT: value_repr: {kind: copy, type: type(inst(FormType))}
- // 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(inst50000011)':
- // CHECK:STDOUT: value_repr: {kind: none, type: type(inst50000012)}
- // CHECK:STDOUT: 'type(inst50000012)':
- // CHECK:STDOUT: value_repr: {kind: none, type: type(inst50000012)}
- // CHECK:STDOUT: facet_types: {}
- // CHECK:STDOUT: insts:
- // CHECK:STDOUT: instF: {kind: Namespace, arg0: name_scope0, arg1: inst<none>, type: type(inst(NamespaceType))}
- // CHECK:STDOUT: inst50000010: {kind: FunctionDecl, arg0: function50000000, arg1: inst_block_empty, type: type(inst50000011)}
- // CHECK:STDOUT: inst50000011: {kind: FunctionType, arg0: function50000000, arg1: specific<none>, type: type(TypeType)}
- // CHECK:STDOUT: inst50000012: {kind: TupleType, arg0: inst_block_empty, type: type(TypeType)}
- // CHECK:STDOUT: inst50000013: {kind: StructValue, arg0: inst_block_empty, type: type(inst50000011)}
- // CHECK:STDOUT: inst50000014: {kind: Return}
- // CHECK:STDOUT: constant_values:
- // CHECK:STDOUT: values:
- // CHECK:STDOUT: instF: concrete_constant(instF)
- // CHECK:STDOUT: inst50000010: concrete_constant(inst50000013)
- // CHECK:STDOUT: inst50000011: concrete_constant(inst50000011)
- // CHECK:STDOUT: inst50000012: concrete_constant(inst50000012)
- // CHECK:STDOUT: inst50000013: concrete_constant(inst50000013)
- // CHECK:STDOUT: symbolic_constants: {}
- // CHECK:STDOUT: inst_blocks:
- // CHECK:STDOUT: inst_block_empty: {}
- // CHECK:STDOUT: exports:
- // CHECK:STDOUT: 0: inst50000010
- // CHECK:STDOUT: generated: {}
- // CHECK:STDOUT: imports: {}
- // CHECK:STDOUT: global_init: {}
- // CHECK:STDOUT: inst_block50000005: {}
- // CHECK:STDOUT: inst_block50000006:
- // CHECK:STDOUT: 0: inst50000014
- // CHECK:STDOUT: inst_block50000007:
- // CHECK:STDOUT: 0: instF
- // CHECK:STDOUT: 1: inst50000010
- // CHECK:STDOUT: value_stores:
- // CHECK:STDOUT: shared_values:
- // CHECK:STDOUT: ints: {}
- // CHECK:STDOUT: reals: {}
- // CHECK:STDOUT: floats: {}
- // CHECK:STDOUT: identifiers:
- // CHECK:STDOUT: identifier0: A
- // CHECK:STDOUT: strings: {}
- // CHECK:STDOUT: ...
- // CHECK:STDOUT: ---
- // CHECK:STDOUT: filename: b.carbon
- // CHECK:STDOUT: sem_ir:
- // CHECK:STDOUT: names:
- // CHECK:STDOUT: name0: B
- // CHECK:STDOUT: name1: A
- // CHECK:STDOUT: import_irs:
- // CHECK:STDOUT: 'import_ir(ApiForImpl)': {decl_id: inst<none>, is_export: false}
- // CHECK:STDOUT: 'import_ir(Cpp)': {decl_id: inst<none>, is_export: false}
- // CHECK:STDOUT: import_ir70000002: {decl_id: inst70000010, is_export: false}
- // CHECK:STDOUT: import_ir_insts:
- // CHECK:STDOUT: import_ir_inst0: {ir_id: import_ir70000002, inst_id: inst50000010}
- // CHECK:STDOUT: import_ir_inst1: {ir_id: import_ir70000002, inst_id: inst50000010}
- // CHECK:STDOUT: clang_decls: {}
- // CHECK:STDOUT: name_scopes:
- // CHECK:STDOUT: name_scope0: {inst: instF, parent_scope: name_scope<none>, has_error: false, extended_scopes: [], names: {name1: inst70000011, name0: inst70000012}}
- // CHECK:STDOUT: name_scope70000001: {inst: inst70000011, parent_scope: name_scope0, has_error: false, extended_scopes: [], names: {name1: inst70000017}}
- // CHECK:STDOUT: entity_names:
- // CHECK:STDOUT: entity_name70000000: {name: name1, parent_scope: name_scope70000001, index: -1, is_template: 0, is_unused: 0, form: constant<none>}
- // CHECK:STDOUT: cpp_global_vars: {}
- // CHECK:STDOUT: functions:
- // CHECK:STDOUT: function70000000: {name: name0, parent_scope: name_scope0, call_param_patterns_id: inst_block_empty, call_params_id: inst_block_empty, body: [inst_block70000006]}
- // CHECK:STDOUT: function70000001: {name: name1, parent_scope: name_scope70000001, call_param_patterns_id: inst_block_empty}
- // CHECK:STDOUT: classes: {}
- // CHECK:STDOUT: interfaces: {}
- // CHECK:STDOUT: associated_constants: {}
- // CHECK:STDOUT: impls: {}
- // CHECK:STDOUT: generics: {}
- // CHECK:STDOUT: specifics: {}
- // CHECK:STDOUT: specific_interfaces: {}
- // CHECK:STDOUT: struct_type_fields:
- // CHECK:STDOUT: struct_type_fields_empty: {}
- // CHECK:STDOUT: types:
- // CHECK:STDOUT: 'type(TypeType)':
- // CHECK:STDOUT: value_repr: {kind: copy, type: type(TypeType)}
- // CHECK:STDOUT: 'type(inst(FormType))':
- // CHECK:STDOUT: value_repr: {kind: copy, type: type(inst(FormType))}
- // 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(inst70000013)':
- // CHECK:STDOUT: value_repr: {kind: none, type: type(inst70000014)}
- // CHECK:STDOUT: 'type(inst70000014)':
- // CHECK:STDOUT: value_repr: {kind: none, type: type(inst70000014)}
- // CHECK:STDOUT: 'type(inst(InstType))':
- // CHECK:STDOUT: value_repr: {kind: none, type: type(inst70000014)}
- // CHECK:STDOUT: facet_types: {}
- // CHECK:STDOUT: insts:
- // CHECK:STDOUT: instF: {kind: Namespace, arg0: name_scope0, arg1: inst<none>, type: type(inst(NamespaceType))}
- // CHECK:STDOUT: inst70000010: {kind: ImportDecl, arg0: name1}
- // CHECK:STDOUT: inst70000011: {kind: Namespace, arg0: name_scope70000001, arg1: inst70000010, type: type(inst(NamespaceType))}
- // CHECK:STDOUT: inst70000012: {kind: FunctionDecl, arg0: function70000000, arg1: inst_block_empty, type: type(inst70000013)}
- // CHECK:STDOUT: inst70000013: {kind: FunctionType, arg0: function70000000, arg1: specific<none>, type: type(TypeType)}
- // CHECK:STDOUT: inst70000014: {kind: TupleType, arg0: inst_block_empty, type: type(TypeType)}
- // CHECK:STDOUT: inst70000015: {kind: StructValue, arg0: inst_block_empty, type: type(inst70000013)}
- // CHECK:STDOUT: inst70000016: {kind: NameRef, arg0: name1, arg1: inst70000011, type: type(inst(NamespaceType))}
- // CHECK:STDOUT: inst70000017: {kind: ImportRefLoaded, arg0: import_ir_inst0, arg1: entity_name70000000, type: type(inst70000019)}
- // CHECK:STDOUT: inst70000018: {kind: FunctionDecl, arg0: function70000001, arg1: inst_block_empty, type: type(inst70000019)}
- // CHECK:STDOUT: inst70000019: {kind: FunctionType, arg0: function70000001, arg1: specific<none>, type: type(TypeType)}
- // CHECK:STDOUT: inst7000001A: {kind: StructValue, arg0: inst_block_empty, type: type(inst70000019)}
- // CHECK:STDOUT: inst7000001B: {kind: NameRef, arg0: name1, arg1: inst70000017, type: type(inst70000019)}
- // CHECK:STDOUT: inst7000001C: {kind: Call, arg0: inst7000001B, arg1: inst_block_empty, type: type(inst70000014)}
- // CHECK:STDOUT: inst7000001D: {kind: Return}
- // CHECK:STDOUT: constant_values:
- // CHECK:STDOUT: values:
- // CHECK:STDOUT: instF: concrete_constant(instF)
- // CHECK:STDOUT: inst70000011: concrete_constant(inst70000011)
- // CHECK:STDOUT: inst70000012: concrete_constant(inst70000015)
- // CHECK:STDOUT: inst70000013: concrete_constant(inst70000013)
- // CHECK:STDOUT: inst70000014: concrete_constant(inst70000014)
- // CHECK:STDOUT: inst70000015: concrete_constant(inst70000015)
- // CHECK:STDOUT: inst70000016: concrete_constant(inst70000011)
- // CHECK:STDOUT: inst70000017: concrete_constant(inst7000001A)
- // CHECK:STDOUT: inst70000018: concrete_constant(inst7000001A)
- // CHECK:STDOUT: inst70000019: concrete_constant(inst70000019)
- // CHECK:STDOUT: inst7000001A: concrete_constant(inst7000001A)
- // CHECK:STDOUT: inst7000001B: concrete_constant(inst7000001A)
- // CHECK:STDOUT: symbolic_constants: {}
- // CHECK:STDOUT: inst_blocks:
- // CHECK:STDOUT: inst_block_empty: {}
- // CHECK:STDOUT: exports:
- // CHECK:STDOUT: 0: inst70000012
- // CHECK:STDOUT: generated: {}
- // CHECK:STDOUT: imports:
- // CHECK:STDOUT: 0: inst70000011
- // CHECK:STDOUT: 1: inst70000017
- // CHECK:STDOUT: 2: inst70000018
- // CHECK:STDOUT: global_init: {}
- // CHECK:STDOUT: inst_block70000005: {}
- // CHECK:STDOUT: inst_block70000006:
- // CHECK:STDOUT: 0: inst70000016
- // CHECK:STDOUT: 1: inst7000001B
- // CHECK:STDOUT: 2: inst7000001C
- // CHECK:STDOUT: 3: inst7000001D
- // CHECK:STDOUT: inst_block70000007:
- // CHECK:STDOUT: 0: instF
- // CHECK:STDOUT: 1: inst70000010
- // CHECK:STDOUT: 2: inst70000012
- // CHECK:STDOUT: value_stores:
- // CHECK:STDOUT: shared_values:
- // CHECK:STDOUT: ints: {}
- // CHECK:STDOUT: reals: {}
- // CHECK:STDOUT: floats: {}
- // CHECK:STDOUT: identifiers:
- // CHECK:STDOUT: identifier0: B
- // CHECK:STDOUT: identifier1: A
- // CHECK:STDOUT: strings: {}
- // CHECK:STDOUT: ...
|