aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/resolve/rust-ast-resolve.cc
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-01-29 14:55:51 +0000
committerPhilip Herron <philip.herron@embecosm.com>2022-01-29 14:56:27 +0000
commit2fbf9cb25e930e2df86d05e0f7f707e69bae2b1f (patch)
treef5fc89773ab1941593f3f2230908919063679c68 /gcc/rust/resolve/rust-ast-resolve.cc
parenta065f205c3171e63b4efee0b9d890782e95a691b (diff)
downloadgcc-2fbf9cb25e930e2df86d05e0f7f707e69bae2b1f.zip
gcc-2fbf9cb25e930e2df86d05e0f7f707e69bae2b1f.tar.gz
gcc-2fbf9cb25e930e2df86d05e0f7f707e69bae2b1f.tar.bz2
Track the cratenum for the respective canonical path
This means we can get the crate name to squash the warning in the V0 symbol mangling scheme.
Diffstat (limited to 'gcc/rust/resolve/rust-ast-resolve.cc')
-rw-r--r--gcc/rust/resolve/rust-ast-resolve.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/rust/resolve/rust-ast-resolve.cc b/gcc/rust/resolve/rust-ast-resolve.cc
index 5e29e25..96524d2 100644
--- a/gcc/rust/resolve/rust-ast-resolve.cc
+++ b/gcc/rust/resolve/rust-ast-resolve.cc
@@ -314,9 +314,9 @@ void
NameResolution::go (AST::Crate &crate)
{
// lookup current crate name
+ CrateNum cnum = mappings->get_current_crate ();
std::string crate_name;
- bool ok
- = mappings->get_crate_name (mappings->get_current_crate (), crate_name);
+ bool ok = mappings->get_crate_name (cnum, crate_name);
rust_assert (ok);
// setup the ribs
@@ -331,10 +331,11 @@ NameResolution::go (AST::Crate &crate)
// get the root segment
CanonicalPath crate_prefix
= CanonicalPath::new_seg (scope_node_id, crate_name);
+ crate_prefix.set_crate_num (cnum);
// first gather the top-level namespace names then we drill down so this
- // allows for resolving forward declarations since an impl block might have a
- // Self type Foo which is defined after the impl block for example.
+ // allows for resolving forward declarations since an impl block might have
+ // a Self type Foo which is defined after the impl block for example.
for (auto it = crate.items.begin (); it != crate.items.end (); it++)
ResolveTopLevel::go (it->get (), CanonicalPath::create_empty (),
crate_prefix);