[llvm] llvm-reduce: Add scope braces (PR #135025)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 9 07:12:11 PDT 2025


https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/135025

Make sure these temporary variables don't leak out
of the NDEBUG block.

>From c02d8362d594873202bd570d92932473ab6ce447 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Sat, 14 Jan 2023 15:17:22 -0500
Subject: [PATCH] llvm-reduce: Add scope braces

Make sure these temporary variables don't leak out
of the NDEBUG block.
---
 llvm/tools/llvm-reduce/deltas/Delta.cpp | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/llvm/tools/llvm-reduce/deltas/Delta.cpp b/llvm/tools/llvm-reduce/deltas/Delta.cpp
index d4106b0243aea..6466314a6c219 100644
--- a/llvm/tools/llvm-reduce/deltas/Delta.cpp
+++ b/llvm/tools/llvm-reduce/deltas/Delta.cpp
@@ -214,14 +214,16 @@ void llvm::runDeltaPass(TestRunner &Test, const DeltaPass &Pass) {
     }
 
 #ifndef NDEBUG
-    // Make sure that the number of chunks does not change as we reduce.
-    std::vector<Chunk> NoChunks = {{0, INT_MAX}};
-    Oracle NoChunksCounter(NoChunks);
-    std::unique_ptr<ReducerWorkItem> Clone =
-      Test.getProgram().clone(Test.getTargetMachine());
-    Pass.Func(NoChunksCounter, *Clone);
-    assert(Targets == NoChunksCounter.count() &&
-           "number of chunks changes when reducing");
+    {
+      // Make sure that the number of chunks does not change as we reduce.
+      std::vector<Chunk> NoChunks = {{0, INT_MAX}};
+      Oracle NoChunksCounter(NoChunks);
+      std::unique_ptr<ReducerWorkItem> Clone =
+        Test.getProgram().clone(Test.getTargetMachine());
+      Pass.Func(NoChunksCounter, *Clone);
+      assert(Targets == NoChunksCounter.count() &&
+             "number of chunks changes when reducing");
+    }
 #endif
   }
   if (!Targets) {



More information about the llvm-commits mailing list