mirror of
https://gcc.gnu.org/git/gcc.git
synced 2026-02-22 12:00:03 -05:00
gccrs: session-manager: Add ast-pretty-expanded dump
gcc/rust/ChangeLog: * rust-session-manager.cc (Session::compile_crate): Allow the dump of prettified AST (Session::dump_ast_pretty): New * rust-session-manager.h: Add new output file for pretty AST dump
This commit is contained in:
@@ -58,6 +58,7 @@ namespace Rust {
|
||||
const char *kLexDumpFile = "gccrs.lex.dump";
|
||||
const char *kASTDumpFile = "gccrs.ast.dump";
|
||||
const char *kASTPrettyDumpFile = "gccrs.ast-pretty.dump";
|
||||
const char *kASTPrettyDumpFileExpanded = "gccrs.ast-pretty-expanded.dump";
|
||||
const char *kASTExpandedDumpFile = "gccrs.ast-expanded.dump";
|
||||
const char *kHIRDumpFile = "gccrs.hir.dump";
|
||||
const char *kHIRPrettyDumpFile = "gccrs.hir-pretty.dump";
|
||||
@@ -531,6 +532,7 @@ Session::compile_crate (const char *filename)
|
||||
// dump AST with expanded stuff
|
||||
rust_debug ("BEGIN POST-EXPANSION AST DUMP");
|
||||
dump_ast_expanded (parser, parsed_crate);
|
||||
dump_ast_pretty (parsed_crate, true);
|
||||
rust_debug ("END POST-EXPANSION AST DUMP");
|
||||
}
|
||||
|
||||
@@ -832,10 +834,14 @@ Session::dump_ast (Parser<Lexer> &parser, AST::Crate &crate) const
|
||||
}
|
||||
|
||||
void
|
||||
Session::dump_ast_pretty (AST::Crate &crate) const
|
||||
Session::dump_ast_pretty (AST::Crate &crate, bool expanded) const
|
||||
{
|
||||
std::ofstream out;
|
||||
out.open (kASTPrettyDumpFile);
|
||||
if (expanded)
|
||||
out.open (kASTPrettyDumpFileExpanded);
|
||||
else
|
||||
out.open (kASTPrettyDumpFile);
|
||||
|
||||
if (out.fail ())
|
||||
{
|
||||
rust_error_at (Linemap::unknown_location (), "cannot open %s:%m; ignored",
|
||||
|
||||
@@ -319,7 +319,7 @@ private:
|
||||
|
||||
void dump_lex (Parser<Lexer> &parser) const;
|
||||
void dump_ast (Parser<Lexer> &parser, AST::Crate &crate) const;
|
||||
void dump_ast_pretty (AST::Crate &crate) const;
|
||||
void dump_ast_pretty (AST::Crate &crate, bool expanded = false) const;
|
||||
void dump_ast_expanded (Parser<Lexer> &parser, AST::Crate &crate) const;
|
||||
void dump_hir (HIR::Crate &crate) const;
|
||||
void dump_hir_pretty (HIR::Crate &crate) const;
|
||||
|
||||
Reference in New Issue
Block a user