aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2023-08-22 17:29:56 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-30 12:36:46 +0100
commit0a5cc7a4cb2d379f17f75491fae8428dec901e1c (patch)
tree8326d6c2689f21211420d1621631c71ef6c34d52
parent53d979f361f214ead438c62d74a9adb2c4383651 (diff)
downloadgcc-0a5cc7a4cb2d379f17f75491fae8428dec901e1c.zip
gcc-0a5cc7a4cb2d379f17f75491fae8428dec901e1c.tar.gz
gcc-0a5cc7a4cb2d379f17f75491fae8428dec901e1c.tar.bz2
gccrs: toplevel: Add comment about running the collector twice
gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::insert_or_error_out): Add documentation comment. (TopLevel::go): Likewise.
-rw-r--r--gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
index fbded3e..b9d0bc7 100644
--- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
+++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
@@ -43,6 +43,9 @@ TopLevel::insert_or_error_out (const Identifier &identifier, const T &node,
if (!result)
{
+ // can we do something like check if the node id is the same? if it is the
+ // same, it's not an error, just the resolver running multiple times?
+
rich_location rich_loc (line_table, loc);
rich_loc.add_range (node_locations[result.error ().existing]);
@@ -54,6 +57,11 @@ TopLevel::insert_or_error_out (const Identifier &identifier, const T &node,
void
TopLevel::go (AST::Crate &crate)
{
+ // we do not include builtin types in the top-level definition collector, as
+ // they are not used until `Late`. furthermore, we run this visitor multiple
+ // times in a row in a fixed-point fashion, so it would make the code
+ // responsible for this ugly and perfom a lot of error checking.
+
for (auto &item : crate.items)
item->accept_vis (*this);
}