]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: mappings: Move lang_item definitions to .cc
authorArthur Cohen <arthur.cohen@embecosm.com>
Mon, 25 Nov 2024 11:37:12 +0000 (12:37 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Fri, 21 Mar 2025 11:33:06 +0000 (12:33 +0100)
gcc/rust/ChangeLog:

* util/rust-hir-map.h: Move definitions from header...
* util/rust-hir-map.cc: ...to source file.

gcc/rust/util/rust-hir-map.cc
gcc/rust/util/rust-hir-map.h

index d1504e108c16dde3471f10900b38c36c943deac4..5f77f570073feac644ccf7e0fde3a2fbf7e344f5 100644 (file)
@@ -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
index bb7318e32eccb10c9e9e2acc8102fdbfa84168c6..14a0514338b462245d9cac7ba66ffa00d6e4e38d 100644 (file)
@@ -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);