Просмотр исходного кода

Move `EntityName`'s `CarbonHashValue()` to be a "hidden friend", like `CarbonHashtableEq()` (#5701)

Context:
https://github.com/carbon-language/carbon-lang/pull/5538/files/dfc50609a5b1184cb7970444c1edd524bf17184d#r2152818374
Boaz Brickner 10 месяцев назад
Родитель
Сommit
8f93bb1045
1 измененных файлов с 8 добавлено и 8 удалено
  1. 8 8
      toolchain/sem_ir/entity_name.h

+ 8 - 8
toolchain/sem_ir/entity_name.h

@@ -24,6 +24,14 @@ struct EntityName : public Printable<EntityName> {
     return std::memcmp(&lhs, &rhs, sizeof(EntityName)) == 0;
   }
 
+  // Hashing for EntityName. See common/hashing.h.
+  friend auto CarbonHashValue(const EntityName& value, uint64_t seed)
+      -> HashCode {
+    Hasher hasher(seed);
+    hasher.HashRaw(value);
+    return static_cast<HashCode>(hasher);
+  }
+
   // The index of the binding, if this is the name of a symbolic binding, or
   // `None` otherwise. This is also `None` for a `.Self` symbolic binding,
   // because such a binding is not assigned an index.
@@ -46,14 +54,6 @@ struct EntityName : public Printable<EntityName> {
   bool is_template : 1 = false;
 };
 
-// Hashing for EntityName. See common/hashing.h.
-inline auto CarbonHashValue(const EntityName& value, uint64_t seed)
-    -> HashCode {
-  Hasher hasher(seed);
-  hasher.HashRaw(value);
-  return static_cast<HashCode>(hasher);
-}
-
 // Value store for EntityName. In addition to the regular ValueStore
 // functionality, this can provide optional canonical IDs for EntityNames.
 struct EntityNameStore : public ValueStore<EntityNameId> {