https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107941 --- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- diagnostic_report_current_module in diagnostic.cc is what outputs the include stack for the text output case.