diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-12-26 23:00:08 +0000 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2025-01-16 14:00:31 +0000 |
commit | 115df226360e769eefb5acc2a1f367e300546bdf (patch) | |
tree | ac459e58129b5bc5369d6685f0f3cd368750ea0d /gcc/rust/util/rust-hir-map.cc | |
parent | 68f142a0e92cc451d92e0bd9a4ca75dc50a7ff8f (diff) | |
download | gcc-115df226360e769eefb5acc2a1f367e300546bdf.zip gcc-115df226360e769eefb5acc2a1f367e300546bdf.tar.gz gcc-115df226360e769eefb5acc2a1f367e300546bdf.tar.bz2 |
mappings: Add get_lang_item_node
This method errors out if the lang item has not been declared yet.
gcc/rust/ChangeLog:
* util/rust-hir-map.cc (Mappings::get_lang_item_node): New.
* util/rust-hir-map.h: New function.
Diffstat (limited to 'gcc/rust/util/rust-hir-map.cc')
-rw-r--r-- | gcc/rust/util/rust-hir-map.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/rust/util/rust-hir-map.cc b/gcc/rust/util/rust-hir-map.cc index 2edf099..bf09c94 100644 --- a/gcc/rust/util/rust-hir-map.cc +++ b/gcc/rust/util/rust-hir-map.cc @@ -1299,5 +1299,15 @@ Mappings::lookup_lang_item_node (LangItem::Kind item_type) return it->second; } +NodeId +Mappings::get_lang_item_node (LangItem::Kind item_type) +{ + if (auto lookup = lookup_lang_item_node (item_type)) + return *lookup; + + rust_fatal_error (UNKNOWN_LOCATION, "failed to find lang item %qs", + LangItem::ToString (item_type).c_str ()); +} + } // namespace Analysis } // namespace Rust |