diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-11-25 12:37:12 +0100 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-03-21 12:33:06 +0100 |
commit | 6524f82fb901ddf5d2b8d60e220b9ec792d8aeeb (patch) | |
tree | 9d40a7c6f2875274817779af98f16888a75956e2 | |
parent | 0b4732e7916b83455230635e1926c0ebe886c5d8 (diff) | |
download | gcc-6524f82fb901ddf5d2b8d60e220b9ec792d8aeeb.zip gcc-6524f82fb901ddf5d2b8d60e220b9ec792d8aeeb.tar.gz gcc-6524f82fb901ddf5d2b8d60e220b9ec792d8aeeb.tar.bz2 |
gccrs: mappings: Move lang_item definitions to .cc
gcc/rust/ChangeLog:
* util/rust-hir-map.h: Move definitions from header...
* util/rust-hir-map.cc: ...to source file.
-rw-r--r-- | gcc/rust/util/rust-hir-map.cc | 19 | ||||
-rw-r--r-- | gcc/rust/util/rust-hir-map.h | 18 |
2 files changed, 21 insertions, 16 deletions
diff --git a/gcc/rust/util/rust-hir-map.cc b/gcc/rust/util/rust-hir-map.cc index d1504e1..5f77f570 100644 --- a/gcc/rust/util/rust-hir-map.cc +++ b/gcc/rust/util/rust-hir-map.cc @@ -1258,5 +1258,24 @@ Mappings::lookup_trait_item_lang_item (LangItem::Kind item, location_t locus) return lookup_trait_item_defid (trait_item_id); } +void +Mappings::insert_lang_item (LangItem::Kind item_type, DefId id) +{ + auto it = lang_item_mappings.find (item_type); + rust_assert (it == lang_item_mappings.end ()); + + lang_item_mappings[item_type] = id; +} + +tl::optional<DefId &> +Mappings::lookup_lang_item (LangItem::Kind item_type) +{ + auto it = lang_item_mappings.find (item_type); + if (it == lang_item_mappings.end ()) + return tl::nullopt; + + return it->second; +} + } // namespace Analysis } // namespace Rust diff --git a/gcc/rust/util/rust-hir-map.h b/gcc/rust/util/rust-hir-map.h index bb7318e..14a0514 100644 --- a/gcc/rust/util/rust-hir-map.h +++ b/gcc/rust/util/rust-hir-map.h @@ -256,22 +256,8 @@ public: return it->second; } - void insert_lang_item (LangItem::Kind item_type, DefId id) - { - auto it = lang_item_mappings.find (item_type); - rust_assert (it == lang_item_mappings.end ()); - - lang_item_mappings[item_type] = id; - } - - tl::optional<DefId &> lookup_lang_item (LangItem::Kind item_type) - { - auto it = lang_item_mappings.find (item_type); - if (it == lang_item_mappings.end ()) - return tl::nullopt; - - return it->second; - } + void insert_lang_item (LangItem::Kind item_type, DefId id); + tl::optional<DefId &> lookup_lang_item (LangItem::Kind item_type); // This will fatal_error when this lang item does not exist DefId get_lang_item (LangItem::Kind item_type, location_t locus); |