From 6f1ae86ce4ba3a5bfd043c2c1328a3e92eb45a69 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Thu, 10 Sep 2026 19:28:25 +0000 Subject: [PATCH] Disable `-Wunused-template` in clangd-tidy (#7750) This is firing on some of our _used_ templates in eval.cpp in clang-tidy 24 It was coming to `-Wall` for clang as well (https://github.com/llvm/llvm-project/issues/202945) but was reverted due to issues like false positives (https://github.com/llvm/llvm-project/pull/218638). Some fixes were applied to try enable in `-Wall` in clang 23 (https://github.com/llvm/llvm-project/pull/222336) but it still remains disabled by default for clang. --- .clangd | 3 ++- toolchain/check/eval.cpp | 6 +----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.clangd b/.clangd index 7b82220acbd8..971c6f182ddf 100644 --- a/.clangd +++ b/.clangd @@ -11,7 +11,8 @@ Diagnostics: # compiler. # `unused-includes`: has false positives, reporting includes unused when # they are used. Probably the same root cause as unused-function. - Suppress: [unused-function, unused-includes] + # `unused-template`: has false positives, which we see in eval.cpp. + Suppress: [unused-function, unused-includes, unused-template] --- diff --git a/toolchain/check/eval.cpp b/toolchain/check/eval.cpp index 2b6b9072704a..ce5523a0c881 100644 --- a/toolchain/check/eval.cpp +++ b/toolchain/check/eval.cpp @@ -878,12 +878,8 @@ static auto ReplaceFieldWithConstantValue(EvalContext& eval_context, // Function template that can be called with an argument of type `T`. Used below // to detect which overloads of `GetConstantValue` exist. -// -// Marked as maybe unused at it seems the use in a requires isn't tracked by the -// latest version of Clang's `-Wunused-template`. -// https://github.com/llvm/llvm-project/issues/218429 template -[[maybe_unused]] static auto Accept(T /*arg*/) -> void {} +static auto Accept(T /*arg*/) -> void {} // Determines whether a `GetConstantValue` overload exists for a given ID type. // Note that we do not check whether `GetConstantValue` is *callable* with a