From: Arthur Cohen <[email protected]>
gcc/rust/ChangeLog:
* resolve/rust-early-name-resolver-2.0.cc
(Early::finalize_simple_import): Cleanup
dead code.
(Early::finalize_rebind_import): Likewise.
* resolve/rust-finalized-name-resolution-context.h: Add class
documentation.
---
This change was merged into the gccrs repository and is posted here for
upstream visibility and potential drive-by review, as requested by GCC
release managers.
Each commit email contains a link to its details on github from where you can
find the Pull-Request and associated discussions.
Commit on github:
https://github.com/Rust-GCC/gccrs/commit/aa86b53ef14562712d9a62d3b7a40d850f8a93da
The commit has NOT been mentioned in any issue.
The commit has been mentioned in the following pull-request(s):
- https://github.com/Rust-GCC/gccrs/pull/4551
.../resolve/rust-early-name-resolver-2.0.cc | 4 ---
.../rust-finalized-name-resolution-context.h | 25 ++++++++++++++++---
2 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/gcc/rust/resolve/rust-early-name-resolver-2.0.cc
b/gcc/rust/resolve/rust-early-name-resolver-2.0.cc
index a7c9ea664..0c5422d2c 100644
--- a/gcc/rust/resolve/rust-early-name-resolver-2.0.cc
+++ b/gcc/rust/resolve/rust-early-name-resolver-2.0.cc
@@ -461,8 +461,6 @@ Early::finalize_simple_import (const Early::ImportPair
&mapping)
for (auto &&definition : data.definitions ())
{
- // dirty = true;
-
ctx.map_usage (Usage (import_id),
Definition (definition.definition.get_node_id ()),
definition.ns);
@@ -540,8 +538,6 @@ Early::finalize_rebind_import (const Early::ImportPair
&mapping)
for (auto &&definition : data.definitions ())
{
- // dirty = true;
-
ctx.map_usage (Usage (import_id),
Definition (definition.definition.get_node_id ()),
definition.ns);
diff --git a/gcc/rust/resolve/rust-finalized-name-resolution-context.h
b/gcc/rust/resolve/rust-finalized-name-resolution-context.h
index e29552d2b..5f3354936 100644
--- a/gcc/rust/resolve/rust-finalized-name-resolution-context.h
+++ b/gcc/rust/resolve/rust-finalized-name-resolution-context.h
@@ -26,18 +26,35 @@ namespace Rust {
namespace Resolver2_0 {
/**
- * Once the name resolution pass is complete, the typechecker can access it
+ * Once the name resolution pass is complete, later passes of the compiler can
+ * access it and still perform name resolution operations - for example, the
+ * typechecker is able to insert method resolution into the name resolution
+ * context.
*
- * FIXME: More documentation
+ * Using this type instead of `NameResolutionContext` provides better APIs
which
+ * are more suited to late passes, which shouldn't have to think about the
inner
+ * workings of name resolution too much.
+ *
+ * This class provides wrappers around all basic name resolution operations
+ * (insertion, lookup) as well as an unsafe way to access the underlying name
+ * resolution context.
*/
class FinalizedNameResolutionContext
{
public:
- /** FIXME: Documentation */
+ /**
+ * Initialize the finalized name resolution context from a filled-out
+ * `NameResolutionContext`. This function should be called after name
+ * resolution is done, and `FinalizedNameResolutionContext` should be used
+ * instead of `NameResolutionContext` by later passes of the pipeline.
+ */
static const FinalizedNameResolutionContext &
init (NameResolutionContext &ctx);
- /** FIXME: Documentation */
+ /**
+ * Access the finalized name resolution context that you previously
+ * initialized with `FinalizedNameResolutionContext::init`
+ */
static FinalizedNameResolutionContext &get ();
/**
--
2.54.0