mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 21:10:12 +01:00
By moving dumping, we can have dumping occur before verification that might CHECK-fail (e.g. parse tree and llvm IR verification). I'm dropping vlogging of raw semir. It was only done when dumping, so `-v` would print zero copies and `-v --dump-raw-sem-ir` would print two copies. The lack of complaints about this suggests it's not needed. I'm making a small change to drop newlines between textual and raw semir. This is an edge case so I don't expect people to really notice in general, but it seemed unusually aware of what's on a stream, and it made it harder to do the dump_stream/raw_dump_stream approach, which I felt would be decent in general, since check is the only phase that can emit two different things (which I could also just drop -- we don't really use raw semir anymore, it doesn't seem like a big need to be able to print it with textual semir, but I'm assuming to just maintain existing behavior). In parse, we were previously dumping the tree on verification errors. I'm removing that because now `--dump-parse-tree` should work fine, where previously it wouldn't.
78 lines
3.6 KiB
Plaintext
78 lines
3.6 KiB
Plaintext
// 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
|
|
//
|
|
// This is checking that the stdin filename is handled consistently across
|
|
// dump flags.
|
|
// TODO: Align lex/parse with check/lower.
|
|
//
|
|
// ARGS: compile - --phase=lower --no-prelude-import --target=x86_64-linux-gnu --dump-tokens --dump-parse-tree --dump-sem-ir --dump-raw-sem-ir --dump-llvm-ir
|
|
//
|
|
// AUTOUPDATE
|
|
// TIP: To test this file alone, run:
|
|
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/stdin.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/stdin.carbon
|
|
|
|
// CHECK:STDOUT: - filename: <stdin>
|
|
// CHECK:STDOUT: tokens:
|
|
// CHECK:STDOUT: - { index: 0, kind: "FileStart", line: 1, column: 1, indent: 1, spelling: "" }
|
|
// CHECK:STDOUT: - { index: 1, kind: "FileEnd", line: 1, column: 1, indent: 1, spelling: "", has_leading_space: true }
|
|
// CHECK:STDOUT: - filename: <stdin>
|
|
// CHECK:STDOUT: parse_tree: [
|
|
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
|
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
|
// CHECK:STDOUT: ]
|
|
// CHECK:STDOUT: ---
|
|
// CHECK:STDOUT: filename: '-'
|
|
// 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: name_scopes:
|
|
// CHECK:STDOUT: name_scope0: {inst: inst14, parent_scope: name_scope<none>, has_error: false, extended_scopes: [], names: {}}
|
|
// CHECK:STDOUT: entity_names: {}
|
|
// CHECK:STDOUT: functions: {}
|
|
// 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: insts:
|
|
// CHECK:STDOUT: inst14: {kind: Namespace, arg0: name_scope0, arg1: inst<none>, type: type(inst(NamespaceType))}
|
|
// CHECK:STDOUT: constant_values:
|
|
// CHECK:STDOUT: inst14: concrete_constant(inst14)
|
|
// CHECK:STDOUT: symbolic_constants: {}
|
|
// CHECK:STDOUT: inst_blocks:
|
|
// CHECK:STDOUT: inst_block_empty: {}
|
|
// CHECK:STDOUT: exports: {}
|
|
// CHECK:STDOUT: imports: {}
|
|
// CHECK:STDOUT: global_init: {}
|
|
// CHECK:STDOUT: inst_block4:
|
|
// CHECK:STDOUT: 0: inst14
|
|
// CHECK:STDOUT: ...
|
|
// CHECK:STDOUT: --- -
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; ModuleID = '-'
|
|
// CHECK:STDOUT: source_filename = "-"
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
|
|
// CHECK:STDOUT: !llvm.dbg.cu = !{!2}
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
|
|
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
|
|
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
|
|
// CHECK:STDOUT: !3 = !DIFile(filename: "-", directory: "")
|