[clang] 397fdb1 - Enclose code in nondebug in #ifndef NDEBUG/#endif (#142189)
via cfe-commits
cfe-commits at lists.llvm.org
Fri May 30 13:34:58 PDT 2025
Author: DeanSturtevant1
Date: 2025-05-30T16:34:55-04:00
New Revision: 397fdb172a515f5cd75aa6bf9ef530ac6eb4dd25
URL: https://github.com/llvm/llvm-project/commit/397fdb172a515f5cd75aa6bf9ef530ac6eb4dd25
DIFF: https://github.com/llvm/llvm-project/commit/397fdb172a515f5cd75aa6bf9ef530ac6eb4dd25.diff
LOG: Enclose code in nondebug in #ifndef NDEBUG/#endif (#142189)
A previous change 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.
Added:
Modified:
clang/lib/AST/ByteCode/InterpBuiltin.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index bfad4e763692f..89c626dd3cee8 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -763,12 +763,12 @@ 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 =
- S.getContext().classify(Call->getArg(0)).value_or(PT_Ptr);
+ 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;
}
More information about the cfe-commits
mailing list