public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] session-manager: Add ast-pretty-expanded dump
@ 2022-08-29 15:32 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-08-29 15:32 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:a9055d8294f28ae84023cc93ae8d8b14747a2d0c
commit a9055d8294f28ae84023cc93ae8d8b14747a2d0c
Author: Arthur Cohen <arthur.cohen@embecosm.com>
Date: Thu Aug 11 17:16:24 2022 +0200
session-manager: Add ast-pretty-expanded dump
Diff:
---
gcc/rust/rust-session-manager.cc | 10 ++++++++--
gcc/rust/rust-session-manager.h | 2 +-
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc
index 6d7f1a85f19..fc66b692c95 100644
--- a/gcc/rust/rust-session-manager.cc
+++ b/gcc/rust/rust-session-manager.cc
@@ -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";
@@ -509,6 +510,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");
}
@@ -810,10 +812,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",
diff --git a/gcc/rust/rust-session-manager.h b/gcc/rust/rust-session-manager.h
index 99dd107239b..b3724c540c3 100644
--- a/gcc/rust/rust-session-manager.h
+++ b/gcc/rust/rust-session-manager.h
@@ -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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-08-29 15:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-29 15:32 [gcc/devel/rust/master] session-manager: Add ast-pretty-expanded dump Thomas Schwinge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).