diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2024-05-03 19:59:43 +0200 |
---|---|---|
committer | P-E-P <32375388+P-E-P@users.noreply.github.com> | 2024-05-17 15:28:30 +0000 |
commit | 1e6a3ee55ed907f6e71e6fccbd872b6f80e8298e (patch) | |
tree | 2a2fcd27887fe5a4af3624020d20c8151de7164d | |
parent | d1dad032ded0c9c9cace45d0211ccd68ec6af755 (diff) | |
download | gcc-1e6a3ee55ed907f6e71e6fccbd872b6f80e8298e.zip gcc-1e6a3ee55ed907f6e71e6fccbd872b6f80e8298e.tar.gz gcc-1e6a3ee55ed907f6e71e6fccbd872b6f80e8298e.tar.bz2 |
Change lookup_hir_generic_param return type
Wrap the function's return type with an optional.
gcc/rust/ChangeLog:
* util/rust-hir-map.cc (Mappings::insert_hir_generic_param): Change
call site to accomodate the new return type.
(Mappings::lookup_hir_generic_param): Wrap the function's return type
with an optional.
* util/rust-hir-map.h: Update the function's prototype.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
-rw-r--r-- | gcc/rust/util/rust-hir-map.cc | 6 | ||||
-rw-r--r-- | gcc/rust/util/rust-hir-map.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/gcc/rust/util/rust-hir-map.cc b/gcc/rust/util/rust-hir-map.cc index 02e24be..457e8af 100644 --- a/gcc/rust/util/rust-hir-map.cc +++ b/gcc/rust/util/rust-hir-map.cc @@ -571,19 +571,19 @@ void Mappings::insert_hir_generic_param (HIR::GenericParam *param) { auto id = param->get_mappings ().get_hirid (); - rust_assert (lookup_hir_generic_param (id) == nullptr); + rust_assert (!lookup_hir_generic_param (id)); hirGenericParamMappings[id] = param; insert_node_to_hir (param->get_mappings ().get_nodeid (), id); insert_location (id, param->get_locus ()); } -HIR::GenericParam * +tl::optional<HIR::GenericParam *> Mappings::lookup_hir_generic_param (HirId id) { auto it = hirGenericParamMappings.find (id); if (it == hirGenericParamMappings.end ()) - return nullptr; + return tl::nullopt; return it->second; } diff --git a/gcc/rust/util/rust-hir-map.h b/gcc/rust/util/rust-hir-map.h index dbfc8c0..2c15097 100644 --- a/gcc/rust/util/rust-hir-map.h +++ b/gcc/rust/util/rust-hir-map.h @@ -152,7 +152,7 @@ public: tl::optional<HIR::PathExprSegment *> lookup_hir_path_expr_seg (HirId id); void insert_hir_generic_param (HIR::GenericParam *expr); - HIR::GenericParam *lookup_hir_generic_param (HirId id); + tl::optional<HIR::GenericParam *> lookup_hir_generic_param (HirId id); void insert_hir_type (HIR::Type *type); HIR::Type *lookup_hir_type (HirId id); |