https://github.com/jellytabby created 
https://github.com/llvm/llvm-project/pull/216177

The `UsesLLVMOffloading` variable is not used when assertions are disabled, 
causing a warning. This fix surpresses that with `[[maybe_unused]]`

>From 02968a16804c0bf907f0132b78641ca8d12b85e6 Mon Sep 17 00:00:00 2001
From: Sophia Herrmann <[email protected]>
Date: Thu, 13 Aug 2026 14:06:10 -0700
Subject: [PATCH] [Offload] Fix unused variable warning when assertions are
 disabled

---
 clang/lib/Driver/ToolChains/Cuda.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Cuda.cpp 
b/clang/lib/Driver/ToolChains/Cuda.cpp
index 77d1f6bb556d5..6036b612b88c0 100644
--- a/clang/lib/Driver/ToolChains/Cuda.cpp
+++ b/clang/lib/Driver/ToolChains/Cuda.cpp
@@ -601,7 +601,7 @@ void NVPTX::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
       static_cast<const toolchains::NVPTXToolChain &>(getToolChain());
   ArgStringList CmdArgs;
 
-  bool UsesLLVMOffloading = Args.hasFlag(
+  [[maybe_unused]] bool UsesLLVMOffloading = Args.hasFlag(
       options::OPT_foffload_via_llvm, options::OPT_fno_offload_via_llvm, 
false);
   assert((UsesLLVMOffloading || TC.getTriple().isNVPTX()) && "Wrong platform");
 

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to