aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/rust-session-manager.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/rust/rust-session-manager.h')
-rw-r--r--gcc/rust/rust-session-manager.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/rust/rust-session-manager.h b/gcc/rust/rust-session-manager.h
index 6fa83d9..0c15711 100644
--- a/gcc/rust/rust-session-manager.h
+++ b/gcc/rust/rust-session-manager.h
@@ -235,6 +235,10 @@ struct Session
* every file so eh. */
std::string injected_crate_name;
+ /* extra files get included during late stages of compilation (e.g. macro
+ * expansion) */
+ std::vector<std::string> extra_files;
+
// backend wrapper to GCC GENERIC
Backend *backend;
@@ -267,6 +271,15 @@ public:
void parse_files (int num_files, const char **files);
void init_options ();
+ /* This function saves the filename data into the session manager using the
+ * `move` semantics, and returns a C-style string referencing the input
+ * std::string */
+ inline const char *include_extra_file (std::string filename)
+ {
+ extra_files.push_back (std::move (filename));
+ return extra_files.back ().c_str ();
+ }
+
private:
Session () = default;
void parse_file (const char *filename);