[llvm] 7b75a3a - [Support] ThreadPool tests: silence warning unused variable 'It'

Alexandre Ganea via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 17 11:23:01 PDT 2021


Author: Alexandre Ganea
Date: 2021-04-17T14:22:50-04:00
New Revision: 7b75a3a8ebf04b321e07f17aac5bfe9cb7c656d1

URL: https://github.com/llvm/llvm-project/commit/7b75a3a8ebf04b321e07f17aac5bfe9cb7c656d1
DIFF: https://github.com/llvm/llvm-project/commit/7b75a3a8ebf04b321e07f17aac5bfe9cb7c656d1.diff

LOG: [Support] ThreadPool tests: silence warning unused variable 'It'

Added: 
    

Modified: 
    llvm/unittests/Support/ThreadPool.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/Support/ThreadPool.cpp b/llvm/unittests/Support/ThreadPool.cpp
index 30a8924d16c4b..a560d5069bff9 100644
--- a/llvm/unittests/Support/ThreadPool.cpp
+++ b/llvm/unittests/Support/ThreadPool.cpp
@@ -246,8 +246,10 @@ TEST_F(ThreadPoolTest, AffinityMask) {
     // Ensure the threads only ran on CPUs 0-3.
     // NOTE: Don't use ASSERT* here because this runs in a subprocess,
     // and will show up as un-executed in the parent.
-    for (auto &It : ThreadsUsed)
-      assert(It.getData().front() < 16UL);
+    assert(llvm::all_of(ThreadsUsed,
+                        [](auto &T) { return T.getData().front() < 16UL; }) &&
+           "Threads ran on more CPUs than expected! The affinity mask does not "
+           "seem to work.");
     return;
   }
   std::string Executable =


        


More information about the llvm-commits mailing list