|
|
@@ -14,42 +14,17 @@
|
|
|
#include "toolchain/diagnostics/diagnostic_emitter.h"
|
|
|
#include "toolchain/parse/node_ids.h"
|
|
|
|
|
|
-// NOLINTNEXTLINE(readability-identifier-naming)
|
|
|
-namespace clang {
|
|
|
-
|
|
|
-// Forward declare indexed types, for integration with ValueStore.
|
|
|
-class SourceLocation;
|
|
|
-
|
|
|
-} // namespace clang
|
|
|
-
|
|
|
namespace Carbon::SemIR {
|
|
|
|
|
|
// Forward declare indexed types, for integration with ValueStore.
|
|
|
class File;
|
|
|
-class ImportIRInst;
|
|
|
-class Inst;
|
|
|
-class NameScope;
|
|
|
-struct AssociatedConstant;
|
|
|
-struct Class;
|
|
|
-struct EntityName;
|
|
|
-struct ExprRegion;
|
|
|
struct FacetTypeInfo;
|
|
|
-struct Function;
|
|
|
-struct Generic;
|
|
|
-struct Specific;
|
|
|
struct SpecificInterface;
|
|
|
-struct ImportCpp;
|
|
|
-struct ImportIR;
|
|
|
-struct Impl;
|
|
|
-struct Interface;
|
|
|
struct StructTypeField;
|
|
|
-struct TypeInfo;
|
|
|
-struct Vtable;
|
|
|
|
|
|
-// The ID of an instruction.
|
|
|
+// The ID of an `Inst`.
|
|
|
struct InstId : public IdBase<InstId> {
|
|
|
static constexpr llvm::StringLiteral Label = "inst";
|
|
|
- using ValueType = Inst;
|
|
|
|
|
|
// The maximum ID, inclusive.
|
|
|
static constexpr int Max = std::numeric_limits<int32_t>::max();
|
|
|
@@ -65,7 +40,7 @@ struct InstId : public IdBase<InstId> {
|
|
|
|
|
|
constexpr InstId InstId::InitTombstone = InstId(NoneIndex - 1);
|
|
|
|
|
|
-// And InstId whose value is a type. The fact it's a type is CHECKed on
|
|
|
+// An InstId whose value is a type. The fact it's a type is CHECKed on
|
|
|
// construction, and this allows that check to be represented in the type
|
|
|
// system.
|
|
|
struct TypeInstId : public InstId {
|
|
|
@@ -239,10 +214,9 @@ struct ConstantId : public IdBase<ConstantId> {
|
|
|
|
|
|
constexpr ConstantId ConstantId::NotConstant = ConstantId(NotConstantIndex);
|
|
|
|
|
|
-// The ID of a EntityName.
|
|
|
+// The ID of a `EntityName`.
|
|
|
struct EntityNameId : public IdBase<EntityNameId> {
|
|
|
static constexpr llvm::StringLiteral Label = "entity_name";
|
|
|
- using ValueType = EntityName;
|
|
|
|
|
|
using IdBase::IdBase;
|
|
|
};
|
|
|
@@ -267,10 +241,9 @@ struct CallParamIndex : public IndexBase<CallParamIndex> {
|
|
|
using IndexBase::IndexBase;
|
|
|
};
|
|
|
|
|
|
-// The ID of a function.
|
|
|
+// The ID of a `Function`.
|
|
|
struct FunctionId : public IdBase<FunctionId> {
|
|
|
static constexpr llvm::StringLiteral Label = "function";
|
|
|
- using ValueType = Function;
|
|
|
|
|
|
using IdBase::IdBase;
|
|
|
};
|
|
|
@@ -288,33 +261,30 @@ struct CheckIRId : public IdBase<CheckIRId> {
|
|
|
|
|
|
constexpr CheckIRId CheckIRId::Cpp = CheckIRId(NoneIndex - 1);
|
|
|
|
|
|
-// The ID of a class.
|
|
|
+// The ID of a `Class`.
|
|
|
struct ClassId : public IdBase<ClassId> {
|
|
|
static constexpr llvm::StringLiteral Label = "class";
|
|
|
- using ValueType = Class;
|
|
|
|
|
|
using IdBase::IdBase;
|
|
|
};
|
|
|
|
|
|
+// The ID of a `Vtable`.
|
|
|
struct VtableId : public IdBase<VtableId> {
|
|
|
static constexpr llvm::StringLiteral Label = "vtable";
|
|
|
- using ValueType = Vtable;
|
|
|
|
|
|
using IdBase::IdBase;
|
|
|
};
|
|
|
|
|
|
-// The ID of an interface.
|
|
|
+// The ID of an `Interface`.
|
|
|
struct InterfaceId : public IdBase<InterfaceId> {
|
|
|
static constexpr llvm::StringLiteral Label = "interface";
|
|
|
- using ValueType = Interface;
|
|
|
|
|
|
using IdBase::IdBase;
|
|
|
};
|
|
|
|
|
|
-// The ID of an associated constant.
|
|
|
+// The ID of an `AssociatedConstant`.
|
|
|
struct AssociatedConstantId : public IdBase<AssociatedConstantId> {
|
|
|
static constexpr llvm::StringLiteral Label = "assoc_const";
|
|
|
- using ValueType = AssociatedConstant;
|
|
|
|
|
|
using IdBase::IdBase;
|
|
|
};
|
|
|
@@ -334,31 +304,28 @@ struct IdentifiedFacetTypeId : public IdBase<IdentifiedFacetTypeId> {
|
|
|
using IdBase::IdBase;
|
|
|
};
|
|
|
|
|
|
-// The ID of an impl.
|
|
|
+// The ID of an `Impl`.
|
|
|
struct ImplId : public IdBase<ImplId> {
|
|
|
using DiagnosticType = Diagnostics::TypeInfo<std::string>;
|
|
|
|
|
|
static constexpr llvm::StringLiteral Label = "impl";
|
|
|
- using ValueType = Impl;
|
|
|
|
|
|
using IdBase::IdBase;
|
|
|
};
|
|
|
|
|
|
-// The ID of a generic.
|
|
|
+// The ID of a `Generic`.
|
|
|
struct GenericId : public IdBase<GenericId> {
|
|
|
static constexpr llvm::StringLiteral Label = "generic";
|
|
|
- using ValueType = Generic;
|
|
|
|
|
|
using IdBase::IdBase;
|
|
|
};
|
|
|
|
|
|
-// The ID of a specific, which is the result of specifying the generic arguments
|
|
|
-// for a generic.
|
|
|
+// The ID of a `Specific`, which is the result of specifying the generic
|
|
|
+// arguments for a generic.
|
|
|
struct SpecificId : public IdBase<SpecificId> {
|
|
|
using DiagnosticType = Diagnostics::TypeInfo<std::string>;
|
|
|
|
|
|
static constexpr llvm::StringLiteral Label = "specific";
|
|
|
- using ValueType = Specific;
|
|
|
|
|
|
using IdBase::IdBase;
|
|
|
};
|
|
|
@@ -423,17 +390,17 @@ struct GenericInstIndex : public IndexBase<GenericInstIndex> {
|
|
|
constexpr GenericInstIndex GenericInstIndex::None =
|
|
|
GenericInstIndex::MakeNone();
|
|
|
|
|
|
+// The ID of an `ImportCpp`.
|
|
|
struct ImportCppId : public IdBase<ImportCppId> {
|
|
|
static constexpr llvm::StringLiteral Label = "import_cpp";
|
|
|
- using ValueType = ImportCpp;
|
|
|
|
|
|
using IdBase::IdBase;
|
|
|
};
|
|
|
|
|
|
-// The ID of an IR within the set of imported IRs, both direct and indirect.
|
|
|
+// The ID of an `ImportIR` within the set of imported IRs, both direct and
|
|
|
+// indirect.
|
|
|
struct ImportIRId : public IdBase<ImportIRId> {
|
|
|
static constexpr llvm::StringLiteral Label = "ir";
|
|
|
- using ValueType = ImportIR;
|
|
|
|
|
|
// The implicit `api` import, for an `impl` file. A null entry is added if
|
|
|
// there is none, as in an `api`, in which case this ID should not show up in
|
|
|
@@ -600,10 +567,9 @@ constexpr int NameId::NonIndexValueCount =
|
|
|
1 CARBON_SPECIAL_NAME_ID(CARBON_SPECIAL_NAME_ID_FOR_COUNT);
|
|
|
#undef CARBON_SPECIAL_NAME_ID_FOR_COUNT
|
|
|
|
|
|
-// The ID of a name scope.
|
|
|
+// The ID of a `NameScope`.
|
|
|
struct NameScopeId : public IdBase<NameScopeId> {
|
|
|
static constexpr llvm::StringLiteral Label = "name_scope";
|
|
|
- using ValueType = NameScope;
|
|
|
|
|
|
// The package (or file) name scope, guaranteed to be the first added.
|
|
|
static const NameScopeId Package;
|
|
|
@@ -739,11 +705,11 @@ class LabelId : public InstBlockId {
|
|
|
using InstBlockId::InstBlockId;
|
|
|
};
|
|
|
|
|
|
+// The ID of an `ExprRegion`.
|
|
|
// TODO: Move this out of sem_ir and into check, if we don't wind up using it
|
|
|
// in the SemIR for expression patterns.
|
|
|
struct ExprRegionId : public IdBase<ExprRegionId> {
|
|
|
static constexpr llvm::StringLiteral Label = "region";
|
|
|
- using ValueType = ExprRegion;
|
|
|
|
|
|
using IdBase::IdBase;
|
|
|
};
|
|
|
@@ -793,10 +759,9 @@ struct TypeId : public IdBase<TypeId> {
|
|
|
auto Print(llvm::raw_ostream& out) const -> void;
|
|
|
};
|
|
|
|
|
|
-// The ID of a Clang Source Location.
|
|
|
+// The ID of a `clang::SourceLocation`.
|
|
|
struct ClangSourceLocId : public IdBase<ClangSourceLocId> {
|
|
|
static constexpr llvm::StringLiteral Label = "clang_source_loc";
|
|
|
- using ValueType = clang::SourceLocation;
|
|
|
|
|
|
using IdBase::IdBase;
|
|
|
};
|
|
|
@@ -835,10 +800,9 @@ struct LibraryNameId : public IdBase<LibraryNameId> {
|
|
|
constexpr LibraryNameId LibraryNameId::Default = LibraryNameId(NoneIndex - 1);
|
|
|
constexpr LibraryNameId LibraryNameId::Error = LibraryNameId(NoneIndex - 2);
|
|
|
|
|
|
-// The ID of an ImportIRInst.
|
|
|
+// The ID of an `ImportIRInst`.
|
|
|
struct ImportIRInstId : public IdBase<ImportIRInstId> {
|
|
|
static constexpr llvm::StringLiteral Label = "import_ir_inst";
|
|
|
- using ValueType = ImportIRInst;
|
|
|
|
|
|
// The maximum ID, non-inclusive. This is constrained to fit inside LocId.
|
|
|
static constexpr int Max =
|