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

Differential Revision: https://reviews.llvm.org/D121850
This commit is contained in:
Dominic Chen 2022-03-16 13:48:20 -07:00
parent 03e82d94fc
commit 6ce08d5c27
2 changed files with 2 additions and 2 deletions

View File

@ -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++;

View File

@ -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());
};