aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/rust/util/rust-hir-map.cc8
-rw-r--r--gcc/rust/util/rust-hir-map.h2
2 files changed, 5 insertions, 5 deletions
diff --git a/gcc/rust/util/rust-hir-map.cc b/gcc/rust/util/rust-hir-map.cc
index ae11e67..025b312 100644
--- a/gcc/rust/util/rust-hir-map.cc
+++ b/gcc/rust/util/rust-hir-map.cc
@@ -612,18 +612,18 @@ void
Mappings::insert_hir_stmt (HIR::Stmt *stmt)
{
auto id = stmt->get_mappings ().get_hirid ();
- rust_assert (lookup_hir_stmt (id) == nullptr);
+ rust_assert (!lookup_hir_stmt (id));
hirStmtMappings[id] = stmt;
insert_node_to_hir (stmt->get_mappings ().get_nodeid (), id);
}
-HIR::Stmt *
+tl::optional<HIR::Stmt *>
Mappings::lookup_hir_stmt (HirId id)
{
auto it = hirStmtMappings.find (id);
if (it == hirStmtMappings.end ())
- return nullptr;
+ return tl::nullopt;
return it->second;
}
@@ -796,7 +796,7 @@ Mappings::resolve_nodeid_to_stmt (NodeId id)
return tl::nullopt;
HirId resolved = it->second;
- return {lookup_hir_stmt (resolved)};
+ return lookup_hir_stmt (resolved);
}
void
diff --git a/gcc/rust/util/rust-hir-map.h b/gcc/rust/util/rust-hir-map.h
index e4f4785..f6db83d 100644
--- a/gcc/rust/util/rust-hir-map.h
+++ b/gcc/rust/util/rust-hir-map.h
@@ -158,7 +158,7 @@ public:
tl::optional<HIR::Type *> lookup_hir_type (HirId id);
void insert_hir_stmt (HIR::Stmt *stmt);
- HIR::Stmt *lookup_hir_stmt (HirId id);
+ tl::optional<HIR::Stmt *> lookup_hir_stmt (HirId id);
void insert_hir_param (HIR::FunctionParam *type);
HIR::FunctionParam *lookup_hir_param (HirId id);