[llvm] 1d338a0 - Wrap ifndef NDEBUG around assertion-only code (#142227)

via llvm-commits llvm-commits at lists.llvm.org
Fri May 30 16:48:23 PDT 2025


Author: Walter Lee
Date: 2025-05-30T19:48:20-04:00
New Revision: 1d338a0b9a0d325bb10cf5181afe73cbd4077d4e

URL: https://github.com/llvm/llvm-project/commit/1d338a0b9a0d325bb10cf5181afe73cbd4077d4e
DIFF: https://github.com/llvm/llvm-project/commit/1d338a0b9a0d325bb10cf5181afe73cbd4077d4e.diff

LOG: Wrap ifndef NDEBUG around assertion-only code (#142227)

Otherwise we get unused variable warnings.

Added: 
    

Modified: 
    llvm/unittests/SandboxIR/RegionTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/SandboxIR/RegionTest.cpp b/llvm/unittests/SandboxIR/RegionTest.cpp
index 7d998b147e37c..5d7283fa1024f 100644
--- a/llvm/unittests/SandboxIR/RegionTest.cpp
+++ b/llvm/unittests/SandboxIR/RegionTest.cpp
@@ -437,10 +437,10 @@ define void @foo(i8 %v) {
 }
 !0 = !{i32 0}
 )IR");
+#ifndef NDEBUG
   llvm::Function *LLVMF = &*M->getFunction("foo");
   sandboxir::Context Ctx(C);
   auto *F = Ctx.createFunction(LLVMF);
-#ifndef NDEBUG
   EXPECT_DEATH(sandboxir::Region::createRegionsFromMD(*F, *TTI), "No region.*");
 #endif
 }


        


More information about the llvm-commits mailing list