File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed
Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -20,12 +20,13 @@ static cpp2::cmdline_processor::register_flag cmd_debug(
2020 []{ flag_debug_output = true ; }
2121);
2222
23- static auto flag_diagnostics_output = false ;
23+ static auto flag_diagnostics = std::string() ;
2424static cpp2::cmdline_processor::register_flag cmd_diagnostics (
2525 9 ,
26- " diagnostics" ,
27- " Emit compiler diagnostics output" ,
28- []{ flag_diagnostics_output = true ; }
26+ " diagnostics outfile" ,
27+ " Emit compiler diagnostics output to outfile (or diagnostics.json if not specified)" ,
28+ nullptr ,
29+ [](std::string const & output){ flag_diagnostics = output; }
2930);
3031
3132static auto flag_quiet = false ;
@@ -179,8 +180,8 @@ auto main(
179180 }
180181
181182 // And, if requested, the diagnostics information
182- if ( flag_diagnostics_output ) {
183- c.diagnostics_print ();
183+ if (flag_diagnostics != " " ) {
184+ c.diagnostics_print (flag_diagnostics );
184185 }
185186 }
186187
Original file line number Diff line number Diff line change @@ -7203,14 +7203,14 @@ class cppfront
72037203 // -----------------------------------------------------------------------
72047204 // diagnostics_print
72057205 //
7206- auto diagnostics_print () const
7206+ auto diagnostics_print (std::string const & file ) const
72077207 -> void
72087208 {
72097209 if (source_loaded)
72107210 {
7211- auto out_file = std::ofstream{ sourcefile+ " - diagnostics" };
7211+ auto outfile = std::ofstream{ file == " " ? " diagnostics.json " : file };
72127212 auto diagnostics = get_diagnostics (sema);
7213- print_diagnostics (out_file , diagnostics);
7213+ print_diagnostics (outfile , diagnostics);
72147214 }
72157215 }
72167216
You can’t perform that action at this time.
0 commit comments