[llvm] llvm/unittests: Suppress warnings to mark them `[[maybe_unused]]` [-Wunused-template] (PR #215565)

NAKAMURA Takumi via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 11 06:43:15 PDT 2026


https://github.com/chapuni created https://github.com/llvm/llvm-project/pull/215565

None

>From c1a3a2e9591206d19ccdf784ce513fe491ede45b Mon Sep 17 00:00:00 2001
From: NAKAMURA Takumi <geek4civic at gmail.com>
Date: Tue, 11 Aug 2026 21:50:36 +0900
Subject: [PATCH] llvm/unittests: Suppress warnings to mark them
 `[[maybe_unused]]` [-Wunused-template]

---
 llvm/unittests/ADT/SmallVectorTest.cpp  | 1 +
 llvm/unittests/IR/IntrinsicsTest.cpp    | 2 +-
 llvm/unittests/Support/RecyclerTest.cpp | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/llvm/unittests/ADT/SmallVectorTest.cpp b/llvm/unittests/ADT/SmallVectorTest.cpp
index ebecacefcb0c5..a678416892ee2 100644
--- a/llvm/unittests/ADT/SmallVectorTest.cpp
+++ b/llvm/unittests/ADT/SmallVectorTest.cpp
@@ -1064,6 +1064,7 @@ struct Emplaceable {
         State(ES_Emplaced) {}
 
   template <class A0Ty, class A1Ty, class A2Ty>
+  [[maybe_unused]]
   Emplaceable(A0Ty &&A0, A1Ty &&A1, A2Ty &&A2)
       : A0(std::forward<A0Ty>(A0)), A1(std::forward<A1Ty>(A1)),
         A2(std::forward<A2Ty>(A2)), State(ES_Emplaced) {}
diff --git a/llvm/unittests/IR/IntrinsicsTest.cpp b/llvm/unittests/IR/IntrinsicsTest.cpp
index d502bf591b7fa..f1d22014e24c4 100644
--- a/llvm/unittests/IR/IntrinsicsTest.cpp
+++ b/llvm/unittests/IR/IntrinsicsTest.cpp
@@ -57,7 +57,7 @@ class IntrinsicsTest : public ::testing::Test {
     }
     return Builder.CreateCall(Decl, ProcessedArgs);
   }
-  template <typename T> void checkIsa(const Instruction &I) {
+  template <typename T> [[maybe_unused]] void checkIsa(const Instruction &I) {
     EXPECT_TRUE(isa<T>(I));
   }
 };
diff --git a/llvm/unittests/Support/RecyclerTest.cpp b/llvm/unittests/Support/RecyclerTest.cpp
index 696e397d3f10e..b4494a0e6ef5e 100644
--- a/llvm/unittests/Support/RecyclerTest.cpp
+++ b/llvm/unittests/Support/RecyclerTest.cpp
@@ -31,7 +31,7 @@ class DecoratedMallocAllocator : public MallocAllocator {
     MallocAllocator::Deallocate(Ptr, Size, Alignment);
   }
 
-  template <typename T> void Deallocate(T *Ptr) {
+  template <typename T> [[maybe_unused]] void Deallocate(T *Ptr) {
     DeallocCount++;
     MallocAllocator::Deallocate(Ptr);
   }



More information about the llvm-commits mailing list