clang-tidy without config changes (#1147)

Separating out existing fixes because of #1148 which turns on more.
This commit is contained in:
Jon Meow
2022-03-22 11:13:27 -07:00
committed by GitHub
parent 694a0a7dfb
commit e5a87af6fe
7 changed files with 25 additions and 27 deletions
@@ -309,8 +309,7 @@ void Interpreter::StepLvalue() {
}
}
case ExpressionKind::PrimitiveOperatorExpression: {
const PrimitiveOperatorExpression& op =
cast<PrimitiveOperatorExpression>(exp);
const auto& op = cast<PrimitiveOperatorExpression>(exp);
if (op.op() != Operator::Deref) {
FATAL() << "Can't treat primitive operator expression as lvalue: "
<< exp;
@@ -319,7 +318,7 @@ void Interpreter::StepLvalue() {
return todo_.Spawn(
std::make_unique<ExpressionAction>(op.arguments()[0]));
} else {
const PointerValue& res = cast<PointerValue>(*act.results()[0]);
const auto& res = cast<PointerValue>(*act.results()[0]);
return todo_.FinishAction(arena_->New<LValue>(res.address()));
}
break;
@@ -580,7 +579,7 @@ void Interpreter::StepExp() {
Nonnull<const Value*> witness =
todo_.ValueOfNode(impl_node, exp.source_loc());
if (witness->kind() == Value::Kind::LValue) {
const LValue& lval = cast<LValue>(*witness);
const auto& lval = cast<LValue>(*witness);
witness = heap_.Read(lval.address(), exp.source_loc());
}
function_scope.Initialize(impl_bind, witness);
@@ -595,8 +594,7 @@ void Interpreter::StepExp() {
std::move(function_scope));
}
case Value::Kind::BoundMethodValue: {
const BoundMethodValue& m =
cast<BoundMethodValue>(*act.results()[0]);
const auto& m = cast<BoundMethodValue>(*act.results()[0]);
const FunctionDeclaration& method = m.declaration();
Nonnull<const Value*> converted_args = Convert(
act.results()[1], &method.param_pattern().static_type());
@@ -689,7 +687,7 @@ void Interpreter::StepExp() {
return todo_.Spawn(
std::make_unique<ExpressionAction>(if_expr.condition()));
} else if (act.pos() == 1) {
const BoolValue& condition = cast<BoolValue>(*act.results()[0]);
const auto& condition = cast<BoolValue>(*act.results()[0]);
return todo_.Spawn(std::make_unique<ExpressionAction>(
condition.value() ? if_expr.then_expression()
: if_expr.else_expression()));