Split SemIR's formatter class into a more typical h+cpp (#5372)

Trying to make it easier to see the API at a glance. The class has
become really long, and this doesn't fundamentally change that, but
hopefully makes it easier to navigate. The entry structure also had some
cruft that I'm removing.

I'm trying to keep functions in the same order as they currently are.
The delta still looks unhappy because of the churn, but hopefully this
at least explains the ordering in formatter.h. You can try using the
"Add indent" commit on the PR to see a better before-after delta.

---------

Co-authored-by: Dana Jansens <danakj@orodu.net>
This commit is contained in:
Jon Ross-Perkins
2025-04-29 18:00:07 +00:00
committed by GitHub
co-authored by Dana Jansens
parent 8ba3da9730
commit 5da87f43da
5 changed files with 1580 additions and 1458 deletions
+3 -2
View File
@@ -569,12 +569,13 @@ auto CompilationUnit::PostCheck() -> void {
};
SemIR::Formatter formatter(&*sem_ir_, should_format_entity);
formatter.Format();
if (vlog_stream_) {
CARBON_VLOG("*** SemIR::File ***\n");
formatter.Print(*vlog_stream_);
formatter.Write(*vlog_stream_);
}
if (print) {
formatter.Print(*driver_env_->output_stream);
formatter.Write(*driver_env_->output_stream);
}
}
if (sem_ir_->has_errors()) {