[compiler-rt] 6ce08d5 - [scudo][tests] Pass read-only vector by reference

Dominic Chen via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 17 10:17:59 PDT 2022


Author: Dominic Chen
Date: 2022-03-17T10:17:36-07:00
New Revision: 6ce08d5c278609de8c53861e30e613030cc9c1de

URL: https://github.com/llvm/llvm-project/commit/6ce08d5c278609de8c53861e30e613030cc9c1de
DIFF: https://github.com/llvm/llvm-project/commit/6ce08d5c278609de8c53861e30e613030cc9c1de.diff

LOG: [scudo][tests] Pass read-only vector by reference

Differential Revision: https://reviews.llvm.org/D121850

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/tests/primary_test.cpp
    compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/tests/primary_test.cpp b/compiler-rt/lib/scudo/standalone/tests/primary_test.cpp
index 3179ed5906dd9..283e2973c1e62 100644
--- a/compiler-rt/lib/scudo/standalone/tests/primary_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/primary_test.cpp
@@ -207,7 +207,7 @@ SCUDO_TYPED_TEST(ScudoPrimaryTest, PrimaryIterate) {
     V.push_back(std::make_pair(ClassId, P));
   }
   scudo::uptr Found = 0;
-  auto Lambda = [V, &Found](scudo::uptr Block) {
+  auto Lambda = [&V, &Found](scudo::uptr Block) {
     for (const auto &Pair : V) {
       if (Pair.second == reinterpret_cast<void *>(Block))
         Found++;

diff  --git a/compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp b/compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp
index a7df3d90e7df5..e656466d68f63 100644
--- a/compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp
@@ -153,7 +153,7 @@ TEST_F(MapAllocatorTest, SecondaryIterate) {
   const scudo::uptr PageSize = scudo::getPageSizeCached();
   for (scudo::uptr I = 0; I < 32U; I++)
     V.push_back(Allocator->allocate(Options, (std::rand() % 16) * PageSize));
-  auto Lambda = [V](scudo::uptr Block) {
+  auto Lambda = [&V](scudo::uptr Block) {
     EXPECT_NE(std::find(V.begin(), V.end(), reinterpret_cast<void *>(Block)),
               V.end());
   };


        


More information about the llvm-commits mailing list