aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/rust-session-manager.h
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-04-19 09:08:38 +0000
committerGitHub <noreply@github.com>2022-04-19 09:08:38 +0000
commit321be1b3c9599a319eb5ec87a1aaafbadef697f0 (patch)
treeb2d0cb6fbe29b3e38b29557b9090464bea927168 /gcc/rust/rust-session-manager.h
parent27ad3813dccc50c9026a99b8e7c1d675c78f72e2 (diff)
parentf876cba554fcc2d4c71f7ccec55555894a005ab2 (diff)
downloadgcc-321be1b3c9599a319eb5ec87a1aaafbadef697f0.zip
gcc-321be1b3c9599a319eb5ec87a1aaafbadef697f0.tar.gz
gcc-321be1b3c9599a319eb5ec87a1aaafbadef697f0.tar.bz2
Merge #1096
1096: macros: add include! macro r=CohenArthur a=liushuyu - add `include!` macro Co-authored-by: liushuyu <liushuyu011@gmail.com>
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);