mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
Remove the SemIRLoc typedef (#5299)
Replace SemIRLoc typedef uses with explicitly SemIR::LocId, loc -> loc_id for consistency.
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
namespace Carbon::Check {
|
||||
|
||||
// Enforces that an integer type has a valid bit width.
|
||||
auto ValidateIntType(Context& context, SemIRLoc loc, SemIR::IntType result)
|
||||
-> bool {
|
||||
auto ValidateIntType(Context& context, SemIR::LocId loc_id,
|
||||
SemIR::IntType result) -> bool {
|
||||
auto bit_width =
|
||||
context.insts().TryGetAs<SemIR::IntValue>(result.bit_width_id);
|
||||
if (!bit_width) {
|
||||
@@ -26,7 +26,7 @@ auto ValidateIntType(Context& context, SemIRLoc loc, SemIR::IntType result)
|
||||
CARBON_DIAGNOSTIC(IntWidthNotPositive, Error,
|
||||
"integer type width of {0} is not positive", TypedInt);
|
||||
context.emitter().Emit(
|
||||
loc, IntWidthNotPositive,
|
||||
loc_id, IntWidthNotPositive,
|
||||
{.type = bit_width->type_id, .value = bit_width_val});
|
||||
return false;
|
||||
}
|
||||
@@ -35,7 +35,7 @@ auto ValidateIntType(Context& context, SemIRLoc loc, SemIR::IntType result)
|
||||
"integer type width of {0} is greater than the "
|
||||
"maximum supported width of {1}",
|
||||
TypedInt, int);
|
||||
context.emitter().Emit(loc, IntWidthTooLarge,
|
||||
context.emitter().Emit(loc_id, IntWidthTooLarge,
|
||||
{.type = bit_width->type_id, .value = bit_width_val},
|
||||
IntStore::MaxIntWidth);
|
||||
return false;
|
||||
@@ -44,7 +44,7 @@ auto ValidateIntType(Context& context, SemIRLoc loc, SemIR::IntType result)
|
||||
}
|
||||
|
||||
// Enforces that the bit width is 64 for a float.
|
||||
auto ValidateFloatBitWidth(Context& context, SemIRLoc loc,
|
||||
auto ValidateFloatBitWidth(Context& context, SemIR::LocId loc_id,
|
||||
SemIR::InstId inst_id) -> bool {
|
||||
auto inst = context.insts().GetAs<SemIR::IntValue>(inst_id);
|
||||
if (context.ints().Get(inst.int_id) == 64) {
|
||||
@@ -52,20 +52,20 @@ auto ValidateFloatBitWidth(Context& context, SemIRLoc loc,
|
||||
}
|
||||
|
||||
CARBON_DIAGNOSTIC(CompileTimeFloatBitWidth, Error, "bit width must be 64");
|
||||
context.emitter().Emit(loc, CompileTimeFloatBitWidth);
|
||||
context.emitter().Emit(loc_id, CompileTimeFloatBitWidth);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Enforces that a float type has a valid bit width.
|
||||
auto ValidateFloatType(Context& context, SemIRLoc loc, SemIR::FloatType result)
|
||||
-> bool {
|
||||
auto ValidateFloatType(Context& context, SemIR::LocId loc_id,
|
||||
SemIR::FloatType result) -> bool {
|
||||
auto bit_width =
|
||||
context.insts().TryGetAs<SemIR::IntValue>(result.bit_width_id);
|
||||
if (!bit_width) {
|
||||
// Symbolic bit width.
|
||||
return true;
|
||||
}
|
||||
return ValidateFloatBitWidth(context, loc, result.bit_width_id);
|
||||
return ValidateFloatBitWidth(context, loc_id, result.bit_width_id);
|
||||
}
|
||||
|
||||
// Gets or forms a type_id for a type, given the instruction kind and arguments.
|
||||
|
||||
Reference in New Issue
Block a user