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

Dominic Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 16 14:06:53 PDT 2022


ddcc created this revision.
ddcc added reviewers: vitalybuka, eugenis, cryptoad, mcgrathr, hctim.
Herald added a project: All.
ddcc requested review of this revision.
Herald added a project: Sanitizers.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121850

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


Index: compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp
===================================================================
--- compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp
+++ compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp
@@ -153,7 +153,7 @@
   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());
   };
Index: compiler-rt/lib/scudo/standalone/tests/primary_test.cpp
===================================================================
--- compiler-rt/lib/scudo/standalone/tests/primary_test.cpp
+++ compiler-rt/lib/scudo/standalone/tests/primary_test.cpp
@@ -207,7 +207,7 @@
     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++;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121850.415973.patch
Type: text/x-patch
Size: 1212 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220316/13348894/attachment.bin>


More information about the llvm-commits mailing list