diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2024-04-25 15:39:33 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-03-17 16:35:24 +0100 |
commit | ead5584a07347847fea93fb5df7ba28fbce1b735 (patch) | |
tree | 38ad1ed3af6067c00562642d656f031cbc9526f3 /gcc/rust/util | |
parent | c4c46f5fd7fa26b3bd5cf653a66ffa9cbb8cb24e (diff) | |
download | gcc-ead5584a07347847fea93fb5df7ba28fbce1b735.zip gcc-ead5584a07347847fea93fb5df7ba28fbce1b735.tar.gz gcc-ead5584a07347847fea93fb5df7ba28fbce1b735.tar.bz2 |
gccrs: Change return type of lookup_impl_block_type
Change the return type to an optional.
gcc/rust/ChangeLog:
* typecheck/rust-type-util.cc (query_type): Adapt code to accomodate
the new return type.
* util/rust-hir-map.cc (Mappings::lookup_impl_block_type): Change
the function's return type and remove the out pointer argument.
* 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')
-rw-r--r-- | gcc/rust/util/rust-hir-map.cc | 9 | ||||
-rw-r--r-- | gcc/rust/util/rust-hir-map.h | 2 |
2 files changed, 5 insertions, 6 deletions
diff --git a/gcc/rust/util/rust-hir-map.cc b/gcc/rust/util/rust-hir-map.cc index a5b1daf..99c2493 100644 --- a/gcc/rust/util/rust-hir-map.cc +++ b/gcc/rust/util/rust-hir-map.cc @@ -486,15 +486,14 @@ Mappings::lookup_hir_impl_block (HirId id) return it->second; } -bool -Mappings::lookup_impl_block_type (HirId id, HIR::ImplBlock **impl_block) +tl::optional<HIR::ImplBlock *> +Mappings::lookup_impl_block_type (HirId id) { auto it = hirImplBlockTypeMappings.find (id); if (it == hirImplBlockTypeMappings.end ()) - return false; + return tl::nullopt; - *impl_block = it->second; - return true; + return it->second; } void diff --git a/gcc/rust/util/rust-hir-map.h b/gcc/rust/util/rust-hir-map.h index 109693e..912d42a 100644 --- a/gcc/rust/util/rust-hir-map.h +++ b/gcc/rust/util/rust-hir-map.h @@ -131,7 +131,7 @@ public: void insert_hir_impl_block (HIR::ImplBlock *item); tl::optional<HIR::ImplBlock *> lookup_hir_impl_block (HirId id); - bool lookup_impl_block_type (HirId id, HIR::ImplBlock **impl_block); + tl::optional<HIR::ImplBlock *> lookup_impl_block_type (HirId id); void insert_module (HIR::Module *module); HIR::Module *lookup_module (HirId id); |