[Lldb-commits] [lldb] [lldb] Fix -Wunused-template (PR #221815)
Aiden Grossman via lldb-commits
lldb-commits at lists.llvm.org
Mon Sep 7 12:53:09 PDT 2026
https://github.com/boomanaiden154 created https://github.com/llvm/llvm-project/pull/221815
This warning was enabled by default in clang 23.1.0 (although reverted for 23.1.1). These fixes still make sense to perform though. Template definitions in headers should not use static, and others are completely unused.
>From b17fa912692a059989497dc54d1a34e62fee9362 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Mon, 7 Sep 2026 19:51:58 +0000
Subject: [PATCH] [lldb] Fix -Wunused-template
This warning was enabled by default in clang 23.1.0 (although reverted
for 23.1.1). These fixes still make sense to perform though. Template
definitions in headers should not use static, and others are completely
unused.
---
.../Protocol/ProtocolMCPServerTest.cpp | 34 -------------------
lldb/unittests/TestingSupport/TestUtilities.h | 2 +-
2 files changed, 1 insertion(+), 35 deletions(-)
diff --git a/lldb/unittests/Protocol/ProtocolMCPServerTest.cpp b/lldb/unittests/Protocol/ProtocolMCPServerTest.cpp
index d83cbfd7c036d9..4b07682bc5df7a 100644
--- a/lldb/unittests/Protocol/ProtocolMCPServerTest.cpp
+++ b/lldb/unittests/Protocol/ProtocolMCPServerTest.cpp
@@ -211,42 +211,8 @@ class ProtocolServerMCPTest : public testing::Test {
Response resp = promised_result.get_future().get();
return toJSON(resp);
}
-
- template <typename Result>
- Expected<json::Value>
- Capture(llvm::unique_function<void(Reply<Result>)> &fn) {
- std::promise<llvm::Expected<Result>> promised_result;
- fn([&promised_result](llvm::Expected<Result> result) {
- promised_result.set_value(std::move(result));
- });
- Run();
- llvm::Expected<Result> result = promised_result.get_future().get();
- if (!result)
- return result.takeError();
- return toJSON(*result);
- }
-
- template <typename Result, typename Params>
- Expected<json::Value>
- Capture(llvm::unique_function<void(const Params &, Reply<Result>)> &fn,
- const Params ¶ms) {
- std::promise<llvm::Expected<Result>> promised_result;
- fn(params, [&promised_result](llvm::Expected<Result> result) {
- promised_result.set_value(std::move(result));
- });
- Run();
- llvm::Expected<Result> result = promised_result.get_future().get();
- if (!result)
- return result.takeError();
- return toJSON(*result);
- }
};
-template <typename T>
-inline testing::internal::EqMatcher<llvm::json::Value> HasJSON(T x) {
- return testing::internal::EqMatcher<llvm::json::Value>(toJSON(x));
-}
-
} // namespace
TEST_F(ProtocolServerMCPTest, Initialization) {
diff --git a/lldb/unittests/TestingSupport/TestUtilities.h b/lldb/unittests/TestingSupport/TestUtilities.h
index 68b4dbc127a7d1..f322716eb6977e 100644
--- a/lldb/unittests/TestingSupport/TestUtilities.h
+++ b/lldb/unittests/TestingSupport/TestUtilities.h
@@ -65,7 +65,7 @@ class TestFile {
std::string Buffer;
};
-template <typename T> static llvm::Expected<T> roundtripJSON(const T &input) {
+template <typename T> llvm::Expected<T> roundtripJSON(const T &input) {
std::string encoded;
llvm::raw_string_ostream OS(encoded);
OS << toJSON(input);
More information about the lldb-commits
mailing list