Skip to content

Commit 85be45d

Browse files
P-E-PCohenArthur
authored andcommitted
Do not dump the AST if the parser emit errors
gcc/rust/ChangeLog: * rust-session-manager.cc (Session::compile_crate): Move the AST dump after parser error check. Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
1 parent 445fd35 commit 85be45d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

gcc/rust/rust-session-manager.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -548,10 +548,6 @@ Session::compile_crate (const char *filename)
548548
handle_crate_name (filename, *ast_crate.get ());
549549

550550
// dump options except lexer dump
551-
if (options.dump_option_enabled (CompileOptions::AST_DUMP_PRETTY))
552-
{
553-
dump_ast_pretty (*ast_crate.get ());
554-
}
555551
if (options.dump_option_enabled (CompileOptions::TARGET_OPTION_DUMP))
556552
{
557553
options.target_data.dump_target_options ();
@@ -560,6 +556,11 @@ Session::compile_crate (const char *filename)
560556
if (saw_errors ())
561557
return;
562558

559+
if (options.dump_option_enabled (CompileOptions::AST_DUMP_PRETTY))
560+
{
561+
dump_ast_pretty (*ast_crate.get ());
562+
}
563+
563564
// setup the mappings for this AST
564565
CrateNum current_crate = mappings.get_current_crate ();
565566
AST::Crate &parsed_crate

0 commit comments

Comments
 (0)