mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Add a feature to explicitly include a file's SemIR (#5961)
Trying to figure out an easy way to debug semir in the prelude, #5703 removed an option to set `--exclude-dump-file-prefix` to empty. But, this is probably an improvement over that flow... With this change, it's possible to add `//@dump-sem-ir-file` to a specific prelude file, and its full IR will be printed. Additionally, it becomes an option with the default `--dump-sem-ir-ranges=only` to add `//@dump-sem-ir-file` and get the full file's IR.
This commit is contained in:
@@ -340,17 +340,17 @@ static auto MaybeDumpFormattedSemIR(
|
||||
return;
|
||||
}
|
||||
|
||||
bool has_ranges = sem_ir.parse_tree().tokens().has_dump_sem_ir_ranges();
|
||||
const auto& tokens = sem_ir.parse_tree().tokens();
|
||||
if (options.dump_sem_ir_ranges ==
|
||||
CheckParseTreesOptions::DumpSemIRRanges::Only &&
|
||||
!has_ranges) {
|
||||
!tokens.has_dump_sem_ir_ranges() && !tokens.has_include_in_dumps()) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool use_dump_sem_ir_ranges =
|
||||
options.dump_sem_ir_ranges !=
|
||||
CheckParseTreesOptions::DumpSemIRRanges::Ignore &&
|
||||
has_ranges;
|
||||
tokens.has_dump_sem_ir_ranges();
|
||||
SemIR::Formatter formatter(&sem_ir, tree_and_subtrees_getter,
|
||||
options.include_in_dumps, use_dump_sem_ir_ranges);
|
||||
formatter.Format();
|
||||
|
||||
Reference in New Issue
Block a user