aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/ast
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2024-04-24 10:51:13 +0200
committerCohenArthur <arthur.cohen@embecosm.com>2024-05-06 15:17:29 +0000
commit8a7256676e5dfacb4720c07bc64a3eed8fe5446e (patch)
tree61a9ee5ef821e9a62ffe5721e96e558c07000328 /gcc/rust/ast
parent3a31617b48a4840b0aa90726333e4e7dedf1493b (diff)
downloadgcc-8a7256676e5dfacb4720c07bc64a3eed8fe5446e.zip
gcc-8a7256676e5dfacb4720c07bc64a3eed8fe5446e.tar.gz
gcc-8a7256676e5dfacb4720c07bc64a3eed8fe5446e.tar.bz2
Change singleton returned type to a referencedevel/rust/master
We do not need a raw pointer for this singleton, nor we need having it on the heap through a smart pointer. gcc/rust/ChangeLog: * ast/rust-ast.h: Change dereference from a pointer to a reference accessor. * ast/rust-expr.h: Likewise. * ast/rust-item.h: Likewise. * ast/rust-macro.h: Likewise. * ast/rust-path.h: Likewise. * ast/rust-pattern.h: Likewise. * ast/rust-type.h: Likewise. * backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address): Likewise. * backend/rust-compile-context.h: Likewise. * backend/rust-compile-expr.cc (CompileExpr::visit): Likewise. (CompileExpr::generate_closure_function): Likewise. * backend/rust-compile-extern.h: Likewise. * backend/rust-compile-implitem.cc (CompileTraitItem::visit): Likewise. * backend/rust-compile-intrinsic.cc (Intrinsics::compile): Likewise. * backend/rust-compile-item.cc (CompileItem::visit): Likewise. * backend/rust-compile-resolve-path.cc (ResolvePathRef::resolve): Likewise. (HIRCompileBase::query_compile): Likewise. * backend/rust-compile-type.cc (TyTyResolveCompile::visit): Likewise. (TyTyResolveCompile::create_dyn_obj_record): Likewise. * backend/rust-compile.cc (HIRCompileBase::coerce_to_dyn_object): Likewise. * backend/rust-mangle-v0.cc (v0_path): Likewise. (v0_mangle_item): Likewise. * checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::go): Likewise. * checks/errors/privacy/rust-privacy-check.cc (Resolver::resolve): Likewise. * checks/errors/rust-const-checker.cc (ConstChecker::ConstChecker): Likewise. * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::UnsafeChecker): Likewise. * checks/lints/rust-lint-marklive-base.h: Likewise. * checks/lints/rust-lint-marklive.cc (MarkLive::go): Likewise. (MarkLive::visit): Likewise. (MarkLive::visit_path_segment): Likewise. * checks/lints/rust-lint-marklive.h: Likewise. * checks/lints/rust-lint-scan-deadcode.h: Likewise. * expand/rust-macro-expand.cc (MacroExpander::expand_invoc): Likewise. * expand/rust-macro-expand.h (struct MacroExpander): Change mapping from pointer to a reference. * expand/rust-proc-macro.cc (BangProcMacro::BangProcMacro): Replace pointer accessor with reference accessor. (AttributeProcMacro::AttributeProcMacro): Likewise. (CustomDeriveProcMacro::CustomDeriveProcMacro): Likewise. * hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_lifetime): Likewise. (ASTLoweringBase::lower_loop_label): Likewise. (ASTLoweringBase::lower_path_expr_seg): Likewise. (ASTLoweringBase::lower_self): Likewise. (ASTLoweringBase::handle_lang_item_attribute): Likewise. (ASTLoweringBase::lower_extern_block): Likewise. (ASTLoweringBase::lower_macro_definition): Likewise. * hir/rust-ast-lower-base.h: Likewise. * hir/rust-ast-lower-block.h: Likewise. * hir/rust-ast-lower-enumitem.h: Likewise. * hir/rust-ast-lower-expr.cc (ASTLoweringExpr::translate): Likewise. (ASTLoweringExpr::visit): Likewise. * hir/rust-ast-lower-extern.h: Likewise. * hir/rust-ast-lower-implitem.cc (ASTLowerImplItem::translate): Likewise. (ASTLowerImplItem::visit): Likewise. (ASTLowerTraitItem::translate): Likewise. (ASTLowerTraitItem::visit): Likewise. * hir/rust-ast-lower-item.cc (ASTLoweringItem::translate): Likewise. (ASTLoweringItem::visit): Likewise. (ASTLoweringSimplePath::lower): Likewise. * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::translate): Likewise. (ASTLoweringPattern::visit): Likewise. * hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::translate): Likewise. (ASTLoweringStmt::visit): Likewise. * hir/rust-ast-lower-struct-field-expr.h: Likewise. * hir/rust-ast-lower-type.cc (ASTLowerTypePath::visit): Likewise. (ASTLowerQualifiedPathInType::visit): Likewise. (ASTLoweringType::translate): Likewise. (ASTLoweringType::visit): Likewise. (ASTLowerGenericParam::translate): Likewise. (ASTLowerGenericParam::visit): Likewise. (ASTLoweringTypeBounds::translate): Likewise. (ASTLoweringTypeBounds::visit): Likewise. (ASTLowerWhereClauseItem::translate): Likewise. (ASTLowerWhereClauseItem::visit): Likewise. * hir/rust-ast-lower.cc (ASTLowering::go): Likewise. (ASTLoweringBlock::visit): Likewise. (ASTLoweringIfBlock::visit): Likewise. (ASTLoweringIfLetBlock::visit): Likewise. (ASTLowerStructExprField::visit): Likewise. (ASTLoweringExprWithBlock::visit): Likewise. (ASTLowerPathInExpression::visit): Likewise. (ASTLoweringBase::lower_qual_path_type): Likewise. (ASTLowerQualPathInExpression::visit): Likewise. * metadata/rust-export-metadata.cc (ExportContext::emit_trait): Likewise. (ExportContext::emit_function): Likewise. (ExportContext::emit_macro): Likewise. (PublicInterface::PublicInterface): Likewise. (PublicInterface::expected_metadata_filename): Likewise. * metadata/rust-export-metadata.h: Likewise. * resolve/rust-ast-resolve-base.h: Likewise. * resolve/rust-ast-resolve-implitem.h: Likewise. * resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit): Likewise. (ResolveItem::visit): Likewise. (ResolveExternItem::visit): Likewise. * resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): Likewise. * resolve/rust-ast-resolve-stmt.h: Likewise. * resolve/rust-ast-resolve-toplevel.h: Likewise. * resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Likewise. (ResolveTypeToCanonicalPath::visit): Likewise. * resolve/rust-ast-resolve-type.h: Likewise. * resolve/rust-ast-resolve.cc (NameResolution::NameResolution): Likewise. (NameResolution::go): Likewise. * resolve/rust-ast-resolve.h: Likewise. * resolve/rust-early-name-resolver-2.0.cc (Early::visit_attributes): Likewise. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::EarlyNameResolver): Likewise. * resolve/rust-late-name-resolver-2.0.cc (next_node_id): Likewise. (next_hir_id): Likewise. * resolve/rust-name-resolution-context.cc (NameResolutionContext::NameResolutionContext): Likewise. * resolve/rust-name-resolver.cc (Resolver::Resolver): Likewise. (Resolver::generate_builtins): Likewise. (Resolver::setup_builtin): Likewise. * resolve/rust-name-resolver.h: Likewise. * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Likewise. (TopLevel::handle_use_glob): Likewise. * rust-session-manager.cc (Session::get_instance): Likewise. (Session::handle_input_files): Likewise. (Session::handle_crate_name): Likewise. (Session::compile_crate): Likewise. (Session::load_extern_crate): Likewise. * rust-session-manager.h: Likewise. * typecheck/rust-autoderef.cc (Adjuster::try_unsize_type): Likewise. * typecheck/rust-coercion.cc (TypeCoercionRules::do_coercion): Likewise. (TypeCoercionRules::coerce_unsafe_ptr): Likewise. (TypeCoercionRules::coerce_borrowed_pointer): Likewise. (TypeCoercionRules::coerce_unsized): Likewise. * typecheck/rust-coercion.h: Likewise. * typecheck/rust-hir-dot-operator.cc (MethodResolver::select): Likewise. * typecheck/rust-hir-inherent-impl-overlap.h: Likewise. * typecheck/rust-hir-path-probe.cc (PathProbeType::process_enum_item_for_candiates): Likewise. (PathProbeType::process_impl_items_for_candidates): Likewise. (PathProbeImplTrait::process_trait_impl_items_for_candidates): Likewise. * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_path_to_trait): Likewise. (TraitItemReference::get_parent_trait_mappings): Likewise. * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::resolve_literal): Likewise. (TypeCheckBase::get_marker_predicate): Likewise. * typecheck/rust-hir-type-check-base.h: Likewise. * typecheck/rust-hir-type-check-enumitem.cc (TypeCheckEnumItem::visit): Likewise. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise. (TypeCheckExpr::resolve_operator_overload): Likewise. (TypeCheckExpr::resolve_fn_trait_call): Likewise. * typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit): Likewise. (TypeCheckImplItem::visit): Likewise. * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): Likewise. * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path): Likewise. (TypeCheckExpr::resolve_segments): Likewise. * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::emit_pattern_size_error): Likewise. (ClosureParamInfer::Resolve): Likewise. * typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::resolve): Likewise. * typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): Likewise. (TypeCheckType::resolve_root_path): Likewise. (TypeResolveGenericParam::visit): Likewise. (ResolveWhereClauseItem::visit): Likewise. * typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn): Likewise. * typecheck/rust-type-util.cc (query_type): Likewise. * typecheck/rust-typecheck-context.cc (TypeCheckContext::compute_inference_variables): Likewise. * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::scan): Likewise. (TypeBoundsProbe::assemble_builtin_candidate): Likewise. (TypeCheckBase::get_predicate_from_bound): Likewise. * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Likewise. (TypeCheckMethodCallExpr::check): Likewise. * typecheck/rust-tyty-call.h: Likewise. * typecheck/rust-tyty-cmp.h: Likewise. * typecheck/rust-tyty-subst.cc (SubstitutionParamMapping::override_context): Likewise. (SubstitutionRef::monomorphize): Likewise. * typecheck/rust-tyty-util.cc (TyVar::get_implicit_infer_var): Likewise. (TyVar::monomorphized_clone): Likewise. (TyWithLocation::TyWithLocation): Likewise. * typecheck/rust-tyty.cc (BaseType::satisfies_bound): Likewise. (InferType::clone): Likewise. (ADTType::handle_substitions): Likewise. (TupleType::handle_substitions): Likewise. (FnType::handle_substitions): Likewise. (ClosureType::setup_fn_once_output): Likewise. (ArrayType::handle_substitions): Likewise. (SliceType::handle_substitions): Likewise. (ReferenceType::handle_substitions): Likewise. (PointerType::handle_substitions): Likewise. (ParamType::handle_substitions): Likewise. * typecheck/rust-tyty.h: Likewise. * typecheck/rust-unify.cc (UnifyRules::UnifyRules): Likewise. (UnifyRules::commit): Likewise. * util/rust-hir-map.cc: Change getter return type to a reference. * util/rust-hir-map.h: Update function's prototype. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc/rust/ast')
-rw-r--r--gcc/rust/ast/rust-ast.h24
-rw-r--r--gcc/rust/ast/rust-expr.h8
-rw-r--r--gcc/rust/ast/rust-item.h22
-rw-r--r--gcc/rust/ast/rust-macro.h2
-rw-r--r--gcc/rust/ast/rust-path.h14
-rw-r--r--gcc/rust/ast/rust-pattern.h32
-rw-r--r--gcc/rust/ast/rust-type.h2
7 files changed, 52 insertions, 52 deletions
diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h
index edf726b..6b67394 100644
--- a/gcc/rust/ast/rust-ast.h
+++ b/gcc/rust/ast/rust-ast.h
@@ -374,7 +374,7 @@ public:
// TODO: put checks in constructor to enforce this rule?
SimplePathSegment (std::string segment_name, location_t locus)
: segment_name (std::move (segment_name)), locus (locus),
- node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
/* Returns whether simple path segment is in an invalid state (currently, if
@@ -425,14 +425,14 @@ public:
location_t locus = UNDEF_LOCATION)
: opening_scope_resolution (has_opening_scope_resolution),
segments (std::move (path_segments)), locus (locus),
- node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
SimplePath (Identifier ident)
: opening_scope_resolution (false),
segments ({SimplePathSegment (ident.as_string (), ident.get_locus ())}),
locus (ident.get_locus ()),
- node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
// Creates an empty SimplePath.
@@ -1127,7 +1127,7 @@ public:
virtual void add_semicolon () {}
protected:
- Stmt () : node_id (Analysis::Mappings::get ()->get_next_node_id ()) {}
+ Stmt () : node_id (Analysis::Mappings::get ().get_next_node_id ()) {}
// Clone function implementation as pure virtual method
virtual Stmt *clone_stmt_impl () const = 0;
@@ -1264,7 +1264,7 @@ public:
protected:
// Constructor
- Expr () : node_id (Analysis::Mappings::get ()->get_next_node_id ()) {}
+ Expr () : node_id (Analysis::Mappings::get ().get_next_node_id ()) {}
// Clone function implementation as pure virtual method
virtual Expr *clone_expr_impl () const = 0;
@@ -1437,7 +1437,7 @@ public:
NodeId get_node_id () const { return node_id; }
protected:
- Type () : node_id (Analysis::Mappings::get ()->get_next_node_id ()) {}
+ Type () : node_id (Analysis::Mappings::get ().get_next_node_id ()) {}
// Clone function implementation as pure virtual method
virtual Type *clone_type_impl () const = 0;
@@ -1519,7 +1519,7 @@ public:
// Constructor
Lifetime (LifetimeType type, std::string name = std::string (),
location_t locus = UNDEF_LOCATION)
- : TypeParamBound (Analysis::Mappings::get ()->get_next_node_id ()),
+ : TypeParamBound (Analysis::Mappings::get ().get_next_node_id ()),
lifetime_type (type), lifetime_name (std::move (name)), locus (locus)
{}
@@ -1588,7 +1588,7 @@ public:
NodeId get_node_id () { return node_id; }
protected:
- GenericParam () : node_id (Analysis::Mappings::get ()->get_next_node_id ()) {}
+ GenericParam () : node_id (Analysis::Mappings::get ().get_next_node_id ()) {}
GenericParam (NodeId node_id) : node_id (node_id) {}
// Clone function implementation as pure virtual method
@@ -1682,12 +1682,12 @@ class TraitItem : public AssociatedItem
{
protected:
TraitItem (location_t locus)
- : node_id (Analysis::Mappings::get ()->get_next_node_id ()),
+ : node_id (Analysis::Mappings::get ().get_next_node_id ()),
vis (Visibility::create_private ()), locus (locus)
{}
TraitItem (Visibility vis, location_t locus)
- : node_id (Analysis::Mappings::get ()->get_next_node_id ()), vis (vis),
+ : node_id (Analysis::Mappings::get ().get_next_node_id ()), vis (vis),
locus (locus)
{}
@@ -1713,7 +1713,7 @@ public:
class ExternalItem : public Visitable
{
public:
- ExternalItem () : node_id (Analysis::Mappings::get ()->get_next_node_id ()) {}
+ ExternalItem () : node_id (Analysis::Mappings::get ().get_next_node_id ()) {}
ExternalItem (NodeId node_id) : node_id (node_id) {}
@@ -1987,7 +1987,7 @@ public:
Crate (std::vector<std::unique_ptr<Item>> items,
std::vector<Attribute> inner_attrs)
: inner_attrs (std::move (inner_attrs)), items (std::move (items)),
- node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
// Copy constructor with vector clone
diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h
index d3dc197..b990358 100644
--- a/gcc/rust/ast/rust-expr.h
+++ b/gcc/rust/ast/rust-expr.h
@@ -26,7 +26,7 @@ public:
LoopLabel (Lifetime loop_label, location_t locus = UNDEF_LOCATION)
: label (std::move (loop_label)), locus (locus),
- node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
// Returns whether the LoopLabel is in an error state.
@@ -1113,7 +1113,7 @@ public:
NodeId get_node_id () const { return node_id; }
protected:
- ArrayElems () : node_id (Analysis::Mappings::get ()->get_next_node_id ()) {}
+ ArrayElems () : node_id (Analysis::Mappings::get ().get_next_node_id ()) {}
// pure virtual clone implementation
virtual ArrayElems *clone_array_elems_impl () const = 0;
@@ -1762,7 +1762,7 @@ protected:
// pure virtual clone implementation
virtual StructExprField *clone_struct_expr_field_impl () const = 0;
- StructExprField () : node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ StructExprField () : node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
NodeId node_id;
@@ -4298,7 +4298,7 @@ private:
public:
MatchCase (MatchArm arm, std::unique_ptr<Expr> expr)
: arm (std::move (arm)), expr (std::move (expr)),
- node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
MatchCase (const MatchCase &other)
diff --git a/gcc/rust/ast/rust-item.h b/gcc/rust/ast/rust-item.h
index c03de9b..faa6bc9 100644
--- a/gcc/rust/ast/rust-item.h
+++ b/gcc/rust/ast/rust-item.h
@@ -86,7 +86,7 @@ public:
= std::vector<std::unique_ptr<TypeParamBound>> (),
std::unique_ptr<Type> type = nullptr,
Attribute outer_attr = Attribute::create_empty ())
- : GenericParam (Analysis::Mappings::get ()->get_next_node_id ()),
+ : GenericParam (Analysis::Mappings::get ().get_next_node_id ()),
outer_attr (std::move (outer_attr)),
type_representation (std::move (type_representation)),
type_param_bounds (std::move (type_param_bounds)),
@@ -210,7 +210,7 @@ public:
location_t locus)
: lifetime (std::move (lifetime)),
lifetime_bounds (std::move (lifetime_bounds)), locus (locus),
- node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
std::string as_string () const override;
@@ -258,7 +258,7 @@ public:
: for_lifetimes (std::move (for_lifetimes)),
bound_type (std::move (bound_type)),
type_param_bounds (std::move (type_param_bounds)),
- node_id (Analysis::Mappings::get ()->get_next_node_id ()), locus (locus)
+ node_id (Analysis::Mappings::get ().get_next_node_id ()), locus (locus)
{}
// Copy constructor requires clone
@@ -339,7 +339,7 @@ class WhereClause
public:
WhereClause (std::vector<std::unique_ptr<WhereClauseItem>> where_clause_items)
: where_clause_items (std::move (where_clause_items)),
- node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
// copy constructor with vector clone
@@ -396,7 +396,7 @@ class Param : public Visitable
public:
Param (std::vector<Attribute> outer_attrs, location_t locus)
: outer_attrs (std::move (outer_attrs)), locus (locus),
- node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
virtual ~Param () = default;
@@ -1018,7 +1018,7 @@ protected:
virtual UseTree *clone_use_tree_impl () const = 0;
UseTree (location_t locus)
- : locus (locus), node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ : locus (locus), node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
};
@@ -1718,7 +1718,7 @@ public:
std::vector<Attribute> outer_attrs = std::vector<Attribute> ())
: outer_attrs (std::move (outer_attrs)), visibility (std::move (vis)),
field_name (std::move (field_name)), field_type (std::move (field_type)),
- node_id (Analysis::Mappings::get ()->get_next_node_id ()), locus (locus)
+ node_id (Analysis::Mappings::get ().get_next_node_id ()), locus (locus)
{}
// Copy constructor
@@ -1878,7 +1878,7 @@ public:
std::vector<Attribute> outer_attrs = std::vector<Attribute> ())
: outer_attrs (std::move (outer_attrs)), visibility (std::move (vis)),
field_type (std::move (field_type)),
- node_id (Analysis::Mappings::get ()->get_next_node_id ()), locus (locus)
+ node_id (Analysis::Mappings::get ().get_next_node_id ()), locus (locus)
{}
// Copy constructor with clone
@@ -3573,7 +3573,7 @@ public:
std::vector<Attribute> outer_attrs, location_t locus)
: name (std::move (name)), param_type (std::move (param_type)),
outer_attrs (std::move (outer_attrs)),
- node_id (Analysis::Mappings::get ()->get_next_node_id ()), locus (locus),
+ node_id (Analysis::Mappings::get ().get_next_node_id ()), locus (locus),
variadic (false)
{}
@@ -3581,13 +3581,13 @@ public:
location_t locus)
: name (std::move (name)), param_type (nullptr),
outer_attrs (std::move (outer_attrs)),
- node_id (Analysis::Mappings::get ()->get_next_node_id ()), locus (locus),
+ node_id (Analysis::Mappings::get ().get_next_node_id ()), locus (locus),
variadic (true)
{}
NamedFunctionParam (std::vector<Attribute> outer_attrs, location_t locus)
: name (""), param_type (nullptr), outer_attrs (std::move (outer_attrs)),
- node_id (Analysis::Mappings::get ()->get_next_node_id ()), locus (locus),
+ node_id (Analysis::Mappings::get ().get_next_node_id ()), locus (locus),
variadic (true)
{}
diff --git a/gcc/rust/ast/rust-macro.h b/gcc/rust/ast/rust-macro.h
index 507e595..5300b59 100644
--- a/gcc/rust/ast/rust-macro.h
+++ b/gcc/rust/ast/rust-macro.h
@@ -720,7 +720,7 @@ private:
location_t locus, bool is_semi_coloned,
std::vector<std::unique_ptr<MacroInvocation>> &&pending_eager_invocs)
: TraitItem (locus), outer_attrs (std::move (outer_attrs)), locus (locus),
- node_id (Analysis::Mappings::get ()->get_next_node_id ()),
+ node_id (Analysis::Mappings::get ().get_next_node_id ()),
invoc_data (std::move (invoc_data)), is_semi_coloned (is_semi_coloned),
kind (kind), builtin_kind (builtin_kind),
pending_eager_invocs (std::move (pending_eager_invocs))
diff --git a/gcc/rust/ast/rust-path.h b/gcc/rust/ast/rust-path.h
index 83412eb..809cec5 100644
--- a/gcc/rust/ast/rust-path.h
+++ b/gcc/rust/ast/rust-path.h
@@ -506,7 +506,7 @@ public:
GenericArgs generic_args = GenericArgs::create_empty ())
: segment_name (std::move (segment_name)),
generic_args (std::move (generic_args)), locus (locus),
- node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
/* Constructor for segment with generic arguments (from segment name and all
@@ -519,7 +519,7 @@ public:
generic_args (GenericArgs (std::move (lifetime_args),
std::move (generic_args),
std::move (binding_args))),
- locus (locus), node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ locus (locus), node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
// Returns whether path expression segment is in an error state.
@@ -621,7 +621,7 @@ public:
: PathPattern (std::move (path_segments)),
outer_attrs (std::move (outer_attrs)),
has_opening_scope_resolution (has_opening_scope_resolution),
- locus (locus), _node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ locus (locus), _node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
// Creates an error state path in expression.
@@ -743,7 +743,7 @@ public:
bool has_separating_scope_resolution, location_t locus)
: ident_segment (std::move (ident_segment)), locus (locus),
has_separating_scope_resolution (has_separating_scope_resolution),
- node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
TypePathSegment (std::string segment_name,
@@ -751,7 +751,7 @@ public:
: ident_segment (PathIdentSegment (std::move (segment_name), locus)),
locus (locus),
has_separating_scope_resolution (has_separating_scope_resolution),
- node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
TypePathSegment (TypePathSegment const &other)
@@ -1149,7 +1149,7 @@ public:
TypePath trait_path = TypePath::create_error ())
: type_to_invoke_on (std::move (invoke_on_type)),
trait_path (std::move (trait_path)), locus (locus),
- node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
// Copy constructor uses custom deep copy for Type to preserve polymorphism
@@ -1243,7 +1243,7 @@ public:
: PathPattern (std::move (path_segments)),
outer_attrs (std::move (outer_attrs)),
path_type (std::move (qual_path_type)), locus (locus),
- _node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ _node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
/* TODO: maybe make a shortcut constructor that has QualifiedPathType
diff --git a/gcc/rust/ast/rust-pattern.h b/gcc/rust/ast/rust-pattern.h
index abf6de6..eb80c73 100644
--- a/gcc/rust/ast/rust-pattern.h
+++ b/gcc/rust/ast/rust-pattern.h
@@ -36,13 +36,13 @@ public:
// Constructor for a literal pattern
LiteralPattern (Literal lit, location_t locus)
: lit (std::move (lit)), locus (locus),
- node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
LiteralPattern (std::string val, Literal::LitType type, location_t locus,
PrimitiveCoreType type_hint)
: lit (Literal (std::move (val), type, type_hint)), locus (locus),
- node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
location_t get_locus () const override final { return locus; }
@@ -90,7 +90,7 @@ public:
std::unique_ptr<Pattern> to_bind = nullptr)
: Pattern (), variable_ident (std::move (ident)), is_ref (is_ref),
is_mut (is_mut), to_bind (std::move (to_bind)), locus (locus),
- node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
IdentifierPattern (NodeId node_id, Identifier ident, location_t locus,
@@ -175,7 +175,7 @@ public:
std::string as_string () const override { return std::string (1, '_'); }
WildcardPattern (location_t locus)
- : locus (locus), node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ : locus (locus), node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
location_t get_locus () const override final { return locus; }
@@ -204,7 +204,7 @@ public:
std::string as_string () const override { return ".."; }
RestPattern (location_t locus)
- : locus (locus), node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ : locus (locus), node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
location_t get_locus () const override final { return locus; }
@@ -390,7 +390,7 @@ public:
bool has_ellipsis_syntax = false)
: lower (std::move (lower)), upper (std::move (upper)),
has_ellipsis_syntax (has_ellipsis_syntax), locus (locus),
- node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
// Copy constructor with clone
@@ -469,7 +469,7 @@ public:
bool ref_has_two_amps, location_t locus)
: has_two_amps (ref_has_two_amps), is_mut (is_mut_reference),
pattern (std::move (pattern)), locus (locus),
- node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
// Copy constructor requires clone
@@ -612,7 +612,7 @@ public:
std::vector<Attribute> outer_attribs,
location_t locus)
: StructPatternField (std::move (outer_attribs), locus,
- Analysis::Mappings::get ()->get_next_node_id ()),
+ Analysis::Mappings::get ().get_next_node_id ()),
index (index), tuple_pattern (std::move (tuple_pattern))
{}
@@ -692,7 +692,7 @@ public:
std::vector<Attribute> outer_attrs,
location_t locus)
: StructPatternField (std::move (outer_attrs), locus,
- Analysis::Mappings::get ()->get_next_node_id ()),
+ Analysis::Mappings::get ().get_next_node_id ()),
ident (std::move (ident)), ident_pattern (std::move (ident_pattern))
{}
@@ -771,7 +771,7 @@ public:
StructPatternFieldIdent (Identifier ident, bool is_ref, bool is_mut,
std::vector<Attribute> outer_attrs, location_t locus)
: StructPatternField (std::move (outer_attrs), locus,
- Analysis::Mappings::get ()->get_next_node_id ()),
+ Analysis::Mappings::get ().get_next_node_id ()),
has_ref (is_ref), has_mut (is_mut), ident (std::move (ident))
{}
@@ -926,7 +926,7 @@ public:
StructPatternElements elems
= StructPatternElements::create_empty ())
: path (std::move (struct_path)), elems (std::move (elems)),
- node_id (Analysis::Mappings::get ()->get_next_node_id ()), locus (locus)
+ node_id (Analysis::Mappings::get ().get_next_node_id ()), locus (locus)
{}
/* TODO: constructor to construct via elements included in
@@ -1146,7 +1146,7 @@ public:
TupleStructPattern (PathInExpression tuple_struct_path,
std::unique_ptr<TupleStructItems> items)
: path (std::move (tuple_struct_path)), items (std::move (items)),
- node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ node_id (Analysis::Mappings::get ().get_next_node_id ())
{
rust_assert (this->items != nullptr);
}
@@ -1395,7 +1395,7 @@ public:
TuplePattern (std::unique_ptr<TuplePatternItems> items, location_t locus)
: items (std::move (items)), locus (locus),
- node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ node_id (Analysis::Mappings::get ().get_next_node_id ())
{
rust_assert (this->items != nullptr);
}
@@ -1462,7 +1462,7 @@ public:
GroupedPattern (std::unique_ptr<Pattern> pattern_in_parens, location_t locus)
: pattern_in_parens (std::move (pattern_in_parens)), locus (locus),
- node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
// Copy constructor uses clone
@@ -1521,7 +1521,7 @@ public:
SlicePattern (std::vector<std::unique_ptr<Pattern>> items, location_t locus)
: items (std::move (items)), locus (locus),
- node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
// Copy constructor with vector clone
@@ -1588,7 +1588,7 @@ public:
AltPattern (std::vector<std::unique_ptr<Pattern>> alts, location_t locus)
: alts (std::move (alts)), locus (locus),
- node_id (Analysis::Mappings::get ()->get_next_node_id ())
+ node_id (Analysis::Mappings::get ().get_next_node_id ())
{}
// Copy constructor with vector clone
diff --git a/gcc/rust/ast/rust-type.h b/gcc/rust/ast/rust-type.h
index 23572a2..410d648 100644
--- a/gcc/rust/ast/rust-type.h
+++ b/gcc/rust/ast/rust-type.h
@@ -52,7 +52,7 @@ public:
bool opening_question_mark = false,
std::vector<LifetimeParam> for_lifetimes
= std::vector<LifetimeParam> ())
- : TypeParamBound (Analysis::Mappings::get ()->get_next_node_id ()),
+ : TypeParamBound (Analysis::Mappings::get ().get_next_node_id ()),
in_parens (in_parens), opening_question_mark (opening_question_mark),
for_lifetimes (std::move (for_lifetimes)),
type_path (std::move (type_path)), locus (locus)