aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/util/rust-hir-map.cc
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2024-05-03 19:59:43 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2025-03-17 16:35:25 +0100
commitc0b38c2aa57b02ceef7925442ae56404d7a20211 (patch)
tree94e166effaf71fdc1bb8bb67144c15258aab4478 /gcc/rust/util/rust-hir-map.cc
parent2fc05741bbf83d04260308c17320eef5d9e459db (diff)
downloadgcc-c0b38c2aa57b02ceef7925442ae56404d7a20211.zip
gcc-c0b38c2aa57b02ceef7925442ae56404d7a20211.tar.gz
gcc-c0b38c2aa57b02ceef7925442ae56404d7a20211.tar.bz2
gccrs: 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>
Diffstat (limited to 'gcc/rust/util/rust-hir-map.cc')
-rw-r--r--gcc/rust/util/rust-hir-map.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/rust/util/rust-hir-map.cc b/gcc/rust/util/rust-hir-map.cc
index c96743a..c3929d8 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;
}