diff options
author | Owen Avery <powerboat9.gamer@gmail.com> | 2024-10-26 20:52:31 -0400 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-03-21 12:32:55 +0100 |
commit | 2a44562d0b65d9ec13d00f7eba87fe77cb1c6af3 (patch) | |
tree | c983fa9d51b4f2bafed7085a8b82d8d43671638b /gcc/rust/checks/errors | |
parent | b1e6a3f76e10d7d9ee3574b7abd9d0281ea2d22d (diff) | |
download | gcc-2a44562d0b65d9ec13d00f7eba87fe77cb1c6af3.zip gcc-2a44562d0b65d9ec13d00f7eba87fe77cb1c6af3.tar.gz gcc-2a44562d0b65d9ec13d00f7eba87fe77cb1c6af3.tar.bz2 |
gccrs: Use name resolver 2.0 for module descendance checks
gcc/rust/ChangeLog:
* checks/errors/privacy/rust-privacy-reporter.cc:
Include rust-immutable-name-resolution-context.h.
(is_child_module): Use ForeverStack::is_module_descendant if name
resolution 2.0 is enabled.
* resolve/rust-forever-stack.h
(ForeverStack::is_module_descendant): Add.
(ForeverStack::dfs_node): Add.
* resolve/rust-forever-stack.hxx
(ForeverStack::dfs_rib): Use ForeverStack::dfs_node.
(ForeverStack::dfs_node): Add.
(ForeverStack::is_module_descendant): Add.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc/rust/checks/errors')
-rw-r--r-- | gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc b/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc index 1ee2097..fa2de9c 100644 --- a/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc +++ b/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc @@ -22,6 +22,7 @@ #include "rust-hir-stmt.h" #include "rust-hir-item.h" #include "rust-attribute-values.h" +#include "rust-immutable-name-resolution-context.h" namespace Rust { namespace Privacy { @@ -93,6 +94,14 @@ static bool is_child_module (Analysis::Mappings &mappings, NodeId parent, NodeId possible_child) { + if (flag_name_resolution_2_0) + { + auto &nr_ctx + = Resolver2_0::ImmutableNameResolutionContext::get ().resolver (); + + return nr_ctx.values.is_module_descendant (parent, possible_child); + } + auto children = mappings.lookup_module_children (parent); if (!children) |