aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2024-11-19 13:57:34 -0500
committerP-E-P <32375388+P-E-P@users.noreply.github.com>2024-11-20 15:34:25 +0000
commita969fd7e38bf7fc167effccb8f15f57c59e067a2 (patch)
tree4e9e4090b3a654dc7b5d8a509efbfa2451d426a8 /gcc
parent65e5335d9c40367f6232d7f3b995b5b4a66f216e (diff)
downloadgcc-a969fd7e38bf7fc167effccb8f15f57c59e067a2.zip
gcc-a969fd7e38bf7fc167effccb8f15f57c59e067a2.tar.gz
gcc-a969fd7e38bf7fc167effccb8f15f57c59e067a2.tar.bz2
Use nr2.0 in PrivacyReporter
gcc/rust/ChangeLog: * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::check_for_privacy_violation): Use name resolver 2.0. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove entries. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc10
-rw-r--r--gcc/testsuite/rust/compile/nr2/exclude2
2 files changed, 9 insertions, 3 deletions
diff --git a/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc b/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc
index 0c3c9f6..9c9f2cf 100644
--- a/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc
+++ b/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc
@@ -127,8 +127,16 @@ PrivacyReporter::check_for_privacy_violation (const NodeId &use_id,
{
NodeId ref_node_id = UNKNOWN_NODEID;
+ if (flag_name_resolution_2_0)
+ {
+ auto &nr_ctx
+ = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
+
+ if (auto id = nr_ctx.lookup (use_id))
+ ref_node_id = *id;
+ }
// FIXME: Don't assert here - we might be dealing with a type
- if (!resolver.lookup_resolved_name (use_id, &ref_node_id))
+ else if (!resolver.lookup_resolved_name (use_id, &ref_node_id))
resolver.lookup_resolved_type (use_id, &ref_node_id);
// FIXME: Assert here. For now, we return since this causes issues when
diff --git a/gcc/testsuite/rust/compile/nr2/exclude b/gcc/testsuite/rust/compile/nr2/exclude
index a73b1f0..2e95696 100644
--- a/gcc/testsuite/rust/compile/nr2/exclude
+++ b/gcc/testsuite/rust/compile/nr2/exclude
@@ -145,8 +145,6 @@ parse_complex_generic_application.rs
parse_complex_generic_application2.rs
path_as_generic_arg.rs
pattern-struct.rs
-privacy1.rs
-privacy3.rs
privacy4.rs
privacy5.rs
privacy8.rs