aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/rust-session-manager.cc
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2020-12-14 15:40:17 +0000
committerGitHub <noreply@github.com>2020-12-14 15:40:17 +0000
commit6e4b74fb77c45a6088e0cca22ec05c28c7f0b6dc (patch)
tree46eb33355b3d0351d4743d19d1d5c46ae9d5677c /gcc/rust/rust-session-manager.cc
parentcef34bd730d80b4664d8633e2cc27a64c5cae246 (diff)
parent52cc571b308d3d0103dd498fd277859e2116791a (diff)
downloadgcc-6e4b74fb77c45a6088e0cca22ec05c28c7f0b6dc.zip
gcc-6e4b74fb77c45a6088e0cca22ec05c28c7f0b6dc.tar.gz
gcc-6e4b74fb77c45a6088e0cca22ec05c28c7f0b6dc.tar.bz2
Merge pull request #62 from SimplyTheOther/master
Expansion code for cfg attributes, bug fixes and minor enhancements in parser
Diffstat (limited to 'gcc/rust/rust-session-manager.cc')
-rw-r--r--gcc/rust/rust-session-manager.cc23
1 files changed, 11 insertions, 12 deletions
diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc
index dd9398b..da50948 100644
--- a/gcc/rust/rust-session-manager.cc
+++ b/gcc/rust/rust-session-manager.cc
@@ -344,8 +344,8 @@ Session::enable_dump (std::string arg)
if (arg == "all")
{
rust_error_at (Location (),
- "dumping all is not supported as of now. choose %<lex%>, "
- "%<parse%>, or %<target_options%>");
+ "dumping all is not supported as of now. choose %<lex%>, %<parse%>, "
+ "or %<target_options%>");
return false;
}
else if (arg == "lex")
@@ -390,8 +390,8 @@ Session::enable_dump (std::string arg)
else
{
rust_error_at (Location (),
- "dump option %qs was unrecognised. choose %<lex%>, "
- "%<parse%>, or %<target_options%>",
+ "dump option %qs was unrecognised. choose %<lex%>, %<parse%>, or "
+ "%<target_options%>",
arg.c_str ());
return false;
}
@@ -472,7 +472,6 @@ Session::parse_file (const char *filename)
if (options.dump_option == CompileOptions::REGISTER_PLUGINS_DUMP)
{
// TODO: what do I dump here?
- return;
}
// injection pipeline stage
@@ -482,7 +481,6 @@ Session::parse_file (const char *filename)
if (options.dump_option == CompileOptions::INJECTION_DUMP)
{
// TODO: what do I dump here? injected crate names?
- return;
}
// expansion pipeline stage
@@ -491,8 +489,10 @@ Session::parse_file (const char *filename)
if (options.dump_option == CompileOptions::EXPANSION_DUMP)
{
- // TODO: what do I dump here? expanded macros? AST with expanded macros?
- return;
+ // dump AST with expanded stuff
+ fprintf (stderr, "BEGIN POST-EXPANSION AST DUMP\n");
+ parser.debug_dump_ast_output (parsed_crate);
+ fprintf (stderr, "END POST-EXPANSION AST DUMP\n");
}
// resolution pipeline stage
@@ -502,7 +502,6 @@ Session::parse_file (const char *filename)
if (options.dump_option == CompileOptions::RESOLUTION_DUMP)
{
// TODO: what do I dump here? resolved names? AST with resolved names?
- return;
}
if (saw_errors ())
@@ -630,8 +629,8 @@ Session::injection (AST::Crate &crate)
* rustc also has a "quote" macro that is defined differently and is
* supposedly not stable so eh. */
/* TODO: actually implement injection of these macros. In particular, derive
- * macros, cfg, and
- * test should be prioritised since they seem to be used the most. */
+ * macros, cfg, and test should be prioritised since they seem to be used the
+ * most. */
// crate injection
std::vector<std::string> names;
@@ -719,7 +718,7 @@ Session::expansion (AST::Crate &crate)
// create extctxt? from parse session, cfg, and resolver?
/* expand by calling cxtctxt object's monotonic_expander's expand_crate
* method. */
- MacroExpander expander (crate, cfg);
+ MacroExpander expander (crate, cfg, *this);
expander.expand_crate ();
// error reporting - check unused macros, get missing fragment specifiers