https://github.com/DeanSturtevant1 created 
https://github.com/llvm/llvm-project/pull/142189

A previous to InterpBuiltin.cpp fixed an unused variable warning by using 
[[maybe unused]] and (void).
The code actually serves no useful purpose in non-debug builds, so let's not 
include it there.


>From 2a78358b97c8a050cb75842094b0b69ece8e49e9 Mon Sep 17 00:00:00 2001
From: DeanSturtevant1 <dsturtev...@google.com>
Date: Fri, 30 May 2025 13:41:21 -0400
Subject: [PATCH] Enclose code that does nothing useful in nondebug in #ifndef
 NDEBUG/#endif in InterpBuiltin.cpp

---
 clang/lib/AST/ByteCode/InterpBuiltin.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp 
b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index bfad4e763692f..55e0061702874 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -763,12 +763,13 @@ static bool interp__builtin_ffs(InterpState &S, CodePtr 
OpPC,
 static bool interp__builtin_addressof(InterpState &S, CodePtr OpPC,
                                       const InterpFrame *Frame,
                                       const CallExpr *Call) {
+#ifndef NDEBUG
   assert(Call->getArg(0)->isLValue());
-  [[maybe_unused]] PrimType PtrT =
+  PrimType PtrT =
       S.getContext().classify(Call->getArg(0)).value_or(PT_Ptr);
   assert(PtrT == PT_Ptr &&
          "Unsupported pointer type passed to __builtin_addressof()");
-  (void)PtrT;
+#endif
   return true;
 }
 

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to