Update files and clang-tidy config to pass with clang-tidy-20 (#4691)

Disables three new warnings because they lean more towards style
conflicts than fixes. I've brought these up on #style.

Other than that, mostly fixing basic issues, and things that
clang-tidy-20 seems to fire where clang-tiday-16 didn't. One particular
curious case is `llvm::StringLiteral::data()` uses, which are flagged as
not strictly null-terminated; I'm switching to `const char*` in those
spots which matches `llvm::formatv`'s format argument, but feels worse.

I'm removing `run_clang_tidy.py` here because I'm observing it give
fewer warnings than `bazel build --config=clang-tidy -k
//toolchain/...`. The latter matches how we enforce in GitHub actions
(and also caches results, and suppresses output for files that have no
issues), so I'm dropping the bespoke script.
This commit is contained in:
Jon Ross-Perkins
2024-12-17 01:25:53 +00:00
committed by GitHub
parent 08f24551ec
commit c832d523be
23 changed files with 51 additions and 93 deletions
@@ -610,6 +610,7 @@ template <const DispatchTableT& Table>
auto BasicDispatch(ssize_t& index, const char* text, char* buffer) -> void {
*buffer = text[index];
++index;
// NOLINTNEXTLINE(readability-avoid-return-with-void-value): For musttail.
[[clang::musttail]] return Table[static_cast<unsigned char>(text[index])](
index, text, buffer);
}
@@ -620,6 +621,7 @@ auto SpecializedDispatch(ssize_t& index, const char* text, char* buffer)
CARBON_CHECK(C == text[index]);
*buffer = C;
++index;
// NOLINTNEXTLINE(readability-avoid-return-with-void-value): For musttail.
[[clang::musttail]] return Table[static_cast<unsigned char>(text[index])](
index, text, buffer);
}