stdin.carbon 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. // This is checking that the stdin filename is handled consistently across
  6. // dump flags.
  7. // TODO: Align lex/parse with check/lower.
  8. //
  9. // 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
  10. //
  11. // AUTOUPDATE
  12. // TIP: To test this file alone, run:
  13. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/stdin.carbon
  14. // TIP: To dump output, run:
  15. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/stdin.carbon
  16. // CHECK:STDOUT: - filename: <stdin>
  17. // CHECK:STDOUT: tokens:
  18. // CHECK:STDOUT: - { index: 0, kind: "FileStart", line: 1, column: 1, indent: 1, spelling: "" }
  19. // CHECK:STDOUT: - { index: 1, kind: "FileEnd", line: 1, column: 1, indent: 1, spelling: "", has_leading_space: true }
  20. // CHECK:STDOUT: - filename: <stdin>
  21. // CHECK:STDOUT: parse_tree: [
  22. // CHECK:STDOUT: {kind: 'FileStart', text: ''},
  23. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  24. // CHECK:STDOUT: ]
  25. // CHECK:STDOUT: ---
  26. // CHECK:STDOUT: filename: '-'
  27. // CHECK:STDOUT: sem_ir:
  28. // CHECK:STDOUT: names: {}
  29. // CHECK:STDOUT: import_irs:
  30. // CHECK:STDOUT: 'import_ir(ApiForImpl)': {decl_id: inst<none>, is_export: false}
  31. // CHECK:STDOUT: 'import_ir(Cpp)': {decl_id: inst<none>, is_export: false}
  32. // CHECK:STDOUT: import_ir_insts: {}
  33. // CHECK:STDOUT: clang_decls: {}
  34. // CHECK:STDOUT: name_scopes:
  35. // CHECK:STDOUT: name_scope0: {inst: instF, parent_scope: name_scope<none>, has_error: false, extended_scopes: [], names: {}}
  36. // CHECK:STDOUT: entity_names: {}
  37. // CHECK:STDOUT: cpp_global_vars: {}
  38. // CHECK:STDOUT: functions: {}
  39. // CHECK:STDOUT: classes: {}
  40. // CHECK:STDOUT: interfaces: {}
  41. // CHECK:STDOUT: associated_constants: {}
  42. // CHECK:STDOUT: impls: {}
  43. // CHECK:STDOUT: generics: {}
  44. // CHECK:STDOUT: specifics: {}
  45. // CHECK:STDOUT: specific_interfaces: {}
  46. // CHECK:STDOUT: struct_type_fields:
  47. // CHECK:STDOUT: struct_type_fields_empty: {}
  48. // CHECK:STDOUT: types:
  49. // CHECK:STDOUT: 'type(TypeType)':
  50. // CHECK:STDOUT: value_repr: {kind: copy, type: type(TypeType)}
  51. // CHECK:STDOUT: 'type(inst(FormType))':
  52. // CHECK:STDOUT: value_repr: {kind: copy, type: type(inst(FormType))}
  53. // CHECK:STDOUT: 'type(Error)':
  54. // CHECK:STDOUT: value_repr: {kind: copy, type: type(Error)}
  55. // CHECK:STDOUT: 'type(inst(NamespaceType))':
  56. // CHECK:STDOUT: value_repr: {kind: copy, type: type(inst(NamespaceType))}
  57. // CHECK:STDOUT: facet_types: {}
  58. // CHECK:STDOUT: insts:
  59. // CHECK:STDOUT: instF: {kind: Namespace, arg0: name_scope0, arg1: inst<none>, type: type(inst(NamespaceType))}
  60. // CHECK:STDOUT: constant_values:
  61. // CHECK:STDOUT: values:
  62. // CHECK:STDOUT: instF: concrete_constant(instF)
  63. // CHECK:STDOUT: symbolic_constants: {}
  64. // CHECK:STDOUT: inst_blocks:
  65. // CHECK:STDOUT: inst_block_empty: {}
  66. // CHECK:STDOUT: exports: {}
  67. // CHECK:STDOUT: imports: {}
  68. // CHECK:STDOUT: global_init: {}
  69. // CHECK:STDOUT: inst_block60000004:
  70. // CHECK:STDOUT: 0: instF
  71. // CHECK:STDOUT: value_stores:
  72. // CHECK:STDOUT: shared_values:
  73. // CHECK:STDOUT: ints: {}
  74. // CHECK:STDOUT: reals: {}
  75. // CHECK:STDOUT: floats: {}
  76. // CHECK:STDOUT: identifiers: {}
  77. // CHECK:STDOUT: strings: {}
  78. // CHECK:STDOUT: ...
  79. // CHECK:STDOUT: --- -
  80. // CHECK:STDOUT:
  81. // CHECK:STDOUT: file {
  82. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {}
  83. // CHECK:STDOUT: }
  84. // CHECK:STDOUT:
  85. // CHECK:STDOUT: ; ModuleID = '-'
  86. // CHECK:STDOUT: source_filename = "-"
  87. // CHECK:STDOUT:
  88. // CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
  89. // CHECK:STDOUT: !llvm.dbg.cu = !{!2}
  90. // CHECK:STDOUT:
  91. // CHECK:STDOUT: !0 = !{i32 7, !"Dwarf Version", i32 5}
  92. // CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
  93. // CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
  94. // CHECK:STDOUT: !3 = !DIFile(filename: "-", directory: "")