[clang] Variable is unused when opt mode is on and assert is turned off (PR #142049)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Fri May 30 07:13:47 PDT 2025


================
@@ -764,7 +764,8 @@ static bool interp__builtin_addressof(InterpState &S, CodePtr OpPC,
                                       const InterpFrame *Frame,
                                       const CallExpr *Call) {
   assert(Call->getArg(0)->isLValue());
-  PrimType PtrT = S.getContext().classify(Call->getArg(0)).value_or(PT_Ptr);
+  [[maybe_unused]] PrimType PtrT =
----------------
shafik wrote:

Typically we use `#ifndef NDEBUG` to avoid doing unnecessary computations example here:

https://github.com/llvm/llvm-project/blob/4d650ef4b3d7a0f21f8681e73586d0319fc3953b/clang/include/clang/AST/Type.h#L8993-L8997

but you can find this all over. 

https://github.com/llvm/llvm-project/pull/142049


More information about the cfe-commits mailing list