aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/rust-session-manager.h
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2022-08-31 13:53:28 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2022-09-26 09:32:34 +0200
commit138a6260124740208b8f3aff2e38617f43b05fe8 (patch)
treefadb7a043b546b3b7319377099840839973fea07 /gcc/rust/rust-session-manager.h
parent4f0a2729d78d77f14140531ca809d1c45311f0c9 (diff)
downloadgcc-138a6260124740208b8f3aff2e38617f43b05fe8.zip
gcc-138a6260124740208b8f3aff2e38617f43b05fe8.tar.gz
gcc-138a6260124740208b8f3aff2e38617f43b05fe8.tar.bz2
rust: Add -frust-compile-until option
This option helps ensure that we do not introduce regressions on various parts of the compilation pipeline. For example, a testcase (or testsuite from the `testing` project) might pass attribute checking, expansion and lowering, but fail during typechecking. Should a change suddenly make that testcase fail expansion, we would not be able to notice it. By generating tests that run up until expansion, typechecking, compilation and so forth we ensure that no regressions are added accidentally to already failing tests/testsuites.
Diffstat (limited to 'gcc/rust/rust-session-manager.h')
-rw-r--r--gcc/rust/rust-session-manager.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/gcc/rust/rust-session-manager.h b/gcc/rust/rust-session-manager.h
index b3724c5..6ecd513 100644
--- a/gcc/rust/rust-session-manager.h
+++ b/gcc/rust/rust-session-manager.h
@@ -199,6 +199,22 @@ struct CompileOptions
} edition
= Edition::E2015;
+ enum class CompileStep
+ {
+ Ast,
+ AttributeCheck,
+ Expansion,
+ NameResolution,
+ Lowering,
+ TypeCheck,
+ Privacy,
+ Unsafety,
+ Const,
+ Compilation,
+ End,
+ } compile_until
+ = CompileStep::End;
+
bool dump_option_enabled (DumpOption option) const
{
return dump_options.find (option) != dump_options.end ();
@@ -239,7 +255,14 @@ struct CompileOptions
edition = static_cast<Edition> (raw_edition);
}
- const Edition &get_edition () { return edition; }
+ const Edition &get_edition () const { return edition; }
+
+ void set_compile_step (int raw_step)
+ {
+ compile_until = static_cast<CompileStep> (raw_step);
+ }
+
+ const CompileStep &get_compile_until () const { return compile_until; }
void set_metadata_output (const std::string &path)
{