Add a ValueT to RelationalValueStore (#5755)

RelationalValueStore is only used in one spot, so starting there.
This commit is contained in:
Jon Ross-Perkins
2025-07-01 20:09:00 +00:00
committed by GitHub
parent 44b2f60c90
commit 864e9cb4a2
3 changed files with 5 additions and 6 deletions
+3 -3
View File
@@ -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
View File
@@ -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,
-2
View File
@@ -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;
};