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

Add a ValueT to RelationalValueStore (#5755)

RelationalValueStore is only used in one spot, so starting there.
Jon Ross-Perkins 10 месяцев назад
Родитель
Сommit
864e9cb4a2
3 измененных файлов с 5 добавлено и 6 удалено
  1. 3 3
      toolchain/base/relational_value_store.h
  2. 2 1
      toolchain/sem_ir/file.h
  3. 0 2
      toolchain/sem_ir/ids.h

+ 3 - 3
toolchain/base/relational_value_store.h

@@ -30,11 +30,11 @@ namespace Carbon {
 // requires storing a bit for presence of each `RelatedIdT`. And it allocates
 // memory for values for all IDs up largest ID present in the store, even if
 // they are not yet used.
-template <typename RelatedIdT, typename IdT>
+template <typename RelatedIdT, typename IdT, typename ValueT>
 class RelationalValueStore {
  public:
-  using ValueType = ValueStoreTypes<IdT>::ValueType;
-  using ConstRefType = ValueStoreTypes<IdT>::ConstRefType;
+  using ValueType = ValueStoreTypes<IdT, ValueT>::ValueType;
+  using ConstRefType = ValueStoreTypes<IdT, ValueT>::ConstRefType;
 
   // Given the related ID and a value, stores the value and returns a mapped ID
   // to reference it in the store.

+ 2 - 1
toolchain/sem_ir/file.h

@@ -62,7 +62,8 @@ struct ExprRegion {
 class File : public Printable<File> {
  public:
   using IdentifiedFacetTypeStore =
-      RelationalValueStore<FacetTypeId, IdentifiedFacetTypeId>;
+      RelationalValueStore<FacetTypeId, IdentifiedFacetTypeId,
+                           IdentifiedFacetType>;
 
   // Starts a new file for Check::CheckParseTree.
   explicit File(const Parse::Tree* parse_tree, CheckIRId check_ir_id,

+ 0 - 2
toolchain/sem_ir/ids.h

@@ -36,7 +36,6 @@ struct ExprRegion;
 struct FacetTypeInfo;
 struct Function;
 struct Generic;
-struct IdentifiedFacetType;
 struct Specific;
 struct SpecificInterface;
 struct ImportCpp;
@@ -331,7 +330,6 @@ struct FacetTypeId : public IdBase<FacetTypeId> {
 // The ID of an resolved facet type value.
 struct IdentifiedFacetTypeId : public IdBase<IdentifiedFacetTypeId> {
   static constexpr llvm::StringLiteral Label = "identified_facet_type";
-  using ValueType = IdentifiedFacetType;
 
   using IdBase::IdBase;
 };