diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2023-08-02 16:57:09 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 19:04:33 +0100 |
commit | c8911dde92a98f1c9230a04c62a5287b562bc720 (patch) | |
tree | 047dcd5a581084b8fc30514dc286b060f258115e /gcc/rust/util/rust-hir-map.h | |
parent | ccef457297594c5eadf57ec402122f260c1edc8f (diff) | |
download | gcc-c8911dde92a98f1c9230a04c62a5287b562bc720.zip gcc-c8911dde92a98f1c9230a04c62a5287b562bc720.tar.gz gcc-c8911dde92a98f1c9230a04c62a5287b562bc720.tar.bz2 |
gccrs: Move extern crate resolving
Move extern crate resolving under the extern crate declaration instead
of doing it under the crate's root as extern crates are not resolved by
the top level resolver.
gcc/rust/ChangeLog:
* metadata/rust-extern-crate.cc (ExternCrate::ExternCrate):
Update definition to allow Extern crate with no content (pure
proc macros).
(ExternCrate::ok): Panic on no content.
(ExternCrate::load): Likewise.
* metadata/rust-extern-crate.h: Update prototypes.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::go):
Remove macro resolution.
(TopLevel::visit): Likewise.
* resolve/rust-toplevel-name-resolver-2.0.h: Add visit prototype
for extern crate.
* rust-session-manager.cc (Session::load_extern_crate): Adapt
content depending on the loaded crate's content.
* util/rust-hir-map.cc (Mappings::lookup_derive_proc_macros):
Change return type to optional because it is way more
convenient.
(Mappings::lookup_bang_proc_macros): Likewise.
(Mappings::lookup_attribute_proc_macros): Likewise.
* util/rust-hir-map.h: Update function prototypes.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc/rust/util/rust-hir-map.h')
-rw-r--r-- | gcc/rust/util/rust-hir-map.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/gcc/rust/util/rust-hir-map.h b/gcc/rust/util/rust-hir-map.h index 49bafb2..06d117d 100644 --- a/gcc/rust/util/rust-hir-map.h +++ b/gcc/rust/util/rust-hir-map.h @@ -30,6 +30,7 @@ #include "rust-privacy-common.h" #include "libproc_macro_internal/proc_macro.h" #include "rust-proc-macro.h" +#include "optional.h" namespace Rust { namespace Analysis { @@ -294,12 +295,12 @@ public: void insert_attribute_proc_macros (CrateNum num, std::vector<AttributeProcMacro> macros); - bool lookup_derive_proc_macros (CrateNum num, - std::vector<CustomDeriveProcMacro> ¯os); - bool lookup_bang_proc_macros (CrateNum num, - std::vector<BangProcMacro> ¯os); - bool lookup_attribute_proc_macros (CrateNum num, - std::vector<AttributeProcMacro> ¯os); + tl::optional<std::vector<CustomDeriveProcMacro> &> + lookup_derive_proc_macros (CrateNum num); + tl::optional<std::vector<BangProcMacro> &> + lookup_bang_proc_macros (CrateNum num); + tl::optional<std::vector<AttributeProcMacro> &> + lookup_attribute_proc_macros (CrateNum num); void insert_derive_proc_macro_def (NodeId id, CustomDeriveProcMacro macro); void insert_bang_proc_macro_def (NodeId id, BangProcMacro macro); |