Move None to IdBase (#5030)

Use CRTP to eliminate per-type declarations of `None`. Note this adds
`None` to a few that may not need it, but eliminates a lot off
boilerplate.

Note this leaves `GenericInstIndex::None` because it has a more complex
construction.

Also fix `InstId::InitTombstone` to be `NoneIndex - 1`
This commit is contained in:
Jon Ross-Perkins
2025-03-01 08:00:17 +00:00
committed by GitHub
parent 5574ad361d
commit f0403dadab
4 changed files with 11 additions and 138 deletions
-5
View File
@@ -29,14 +29,9 @@ struct DeferredDefinitionIndex : public IndexBase<DeferredDefinitionIndex> {
static constexpr llvm::StringLiteral Label = "deferred_def";
using ValueType = DeferredDefinition;
static const DeferredDefinitionIndex None;
using IndexBase::IndexBase;
};
constexpr DeferredDefinitionIndex DeferredDefinitionIndex::None =
DeferredDefinitionIndex(NoneIndex);
// A function whose definition is deferred because it is defined inline in a
// class or similar scope.
//