diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2023-04-18 17:26:07 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 18:34:15 +0100 |
commit | 1ca5d5f84c96bb9a47eeb1bbdeb7ae695f7a759e (patch) | |
tree | ce224ae43ee8b2b213fc336ccbf1cf5ae6a29cf2 /gcc/rust/rust-session-manager.cc | |
parent | 582accedb77b7b957e1322966a0875491156d13a (diff) | |
download | gcc-1ca5d5f84c96bb9a47eeb1bbdeb7ae695f7a759e.zip gcc-1ca5d5f84c96bb9a47eeb1bbdeb7ae695f7a759e.tar.gz gcc-1ca5d5f84c96bb9a47eeb1bbdeb7ae695f7a759e.tar.bz2 |
gccrs: cli: Add frust-extern option
Add a new option to gather extern crates location.
gcc/rust/ChangeLog:
* lang.opt: Add frust-extern option.
* rust-session-manager.cc (Session::handle_extern_option): Add
frust-extern option handler.
* rust-session-manager.h (struct Session): Add an unordered map
to store library name and locations.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc/rust/rust-session-manager.cc')
-rw-r--r-- | gcc/rust/rust-session-manager.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc index c8d7b29..fadb8fb 100644 --- a/gcc/rust/rust-session-manager.cc +++ b/gcc/rust/rust-session-manager.cc @@ -190,6 +190,11 @@ Session::handle_option ( } break; + case OPT_frust_extern_: { + std::string input (arg); + ret = handle_extern_option (input); + } + break; case OPT_frust_crate_: // set the crate name if (arg != nullptr) @@ -250,6 +255,20 @@ Session::handle_option ( } bool +Session::handle_extern_option (std::string &input) +{ + auto pos = input.find ('='); + if (std::string::npos == pos) + return false; + + std::string libname = input.substr (0, pos); + std::string path = input.substr (pos + 1); + + extern_crates.insert ({libname, path}); + return true; +} + +bool Session::handle_cfg_option (std::string &input) { std::string key; |