mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 21:41:27 +01:00
Add Inst::IsOneOf to check if an inst is one of a few kinds (#6523)
Adds Inst::IsOneOf which takes a variadic generic parameter pack of kinds to check against. Also add forwarding functions to TypeStore and InstStore. Convert uses of the regex `Is<.*\|\|` to IsOneOf. This is based on #6522
This commit is contained in:
@@ -758,8 +758,7 @@ static auto IsLiteralType(const File& sem_ir, TypeId type_id) -> bool {
|
||||
// Unwrap adapters.
|
||||
type_id = sem_ir.types().GetTransitiveAdaptedType(type_id);
|
||||
auto type_inst_id = sem_ir.types().GetAsInst(type_id);
|
||||
return type_inst_id.Is<IntLiteralType>() ||
|
||||
type_inst_id.Is<FloatLiteralType>();
|
||||
return type_inst_id.IsOneOf<IntLiteralType, FloatLiteralType>();
|
||||
}
|
||||
|
||||
// Determines whether a builtin call involves an integer or floating-point
|
||||
|
||||
Reference in New Issue
Block a user