From 52fe8e0867d54e752a3dd5fd4f45ae4781dd07de Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Tue, 7 Jan 2025 22:42:28 +0000 Subject: [PATCH] Address clang-tidy findings from #4763. --- toolchain/sem_ir/inst_fingerprinter.cpp | 6 +++--- toolchain/sem_ir/inst_namer.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/toolchain/sem_ir/inst_fingerprinter.cpp b/toolchain/sem_ir/inst_fingerprinter.cpp index 8140f7dbbc1d5..0ca3c5555a1a4 100644 --- a/toolchain/sem_ir/inst_fingerprinter.cpp +++ b/toolchain/sem_ir/inst_fingerprinter.cpp @@ -233,7 +233,7 @@ struct Worklist { } auto Add(ImportIRId ir_id) -> void { - auto* ir = sem_ir->import_irs().Get(ir_id).sem_ir; + const auto* ir = sem_ir->import_irs().Get(ir_id).sem_ir; Add(ir->package_id()); Add(ir->library_id()); } @@ -267,7 +267,7 @@ struct Worklist { using Kind = decltype(kind); // Build a lookup table to add an argument of the given kind. - static constexpr std::array table = [] { + static constexpr std::array Table = [] { std::array table; table[Kind::None.ToIndex()] = [](Worklist& /*worklist*/, uint64_t /*arg*/) {}; @@ -283,7 +283,7 @@ struct Worklist { return table; }(); - table[kind.ToIndex()](*this, arg); + Table[kind.ToIndex()](*this, arg); } // Ensure all the instructions on the todo list have fingerprints. diff --git a/toolchain/sem_ir/inst_namer.cpp b/toolchain/sem_ir/inst_namer.cpp index 73de9b7e07008..86bea57299bb3 100644 --- a/toolchain/sem_ir/inst_namer.cpp +++ b/toolchain/sem_ir/inst_namer.cpp @@ -249,7 +249,7 @@ auto InstNamer::Namespace::AllocateName( // Append location information to try to disambiguate. // TODO: Consider handling inst_id cases. - if (LocId* loc_id = std::get_if(&loc_id_or_fingerprint)) { + if (auto* loc_id = std::get_if(&loc_id_or_fingerprint)) { if (loc_id->is_node_id()) { const auto& tree = inst_namer.sem_ir_->parse_tree(); auto token = tree.node_token(loc_id->node_id());