Skip to content

Commit bd4bf49

Browse files
committed
[NFC][asan] Add const to QuarantineCallback methods
1 parent 191c162 commit bd4bf49

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

compiler-rt/lib/asan/asan_allocator.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,14 @@ struct QuarantineCallback {
212212
stack_(stack) {
213213
}
214214

215-
void PreQuarantine(AsanChunk *m) {
215+
void PreQuarantine(AsanChunk *m) const {
216216
FillChunk(m);
217217
// Poison the region.
218218
PoisonShadow(m->Beg(), RoundUpTo(m->UsedSize(), ASAN_SHADOW_GRANULARITY),
219219
kAsanHeapFreeMagic);
220220
}
221221

222-
void Recycle(AsanChunk *m) {
222+
void Recycle(AsanChunk *m) const {
223223
void *p = get_allocator().GetBlockBegin(m);
224224
if (p != m) {
225225
// Clear the magic value, as allocator internals may overwrite the
@@ -244,23 +244,21 @@ struct QuarantineCallback {
244244
get_allocator().Deallocate(cache_, p);
245245
}
246246

247-
void RecyclePassThrough(AsanChunk *m) {
247+
void RecyclePassThrough(AsanChunk *m) const {
248248
// TODO: We don't need all these here.
249249
PreQuarantine(m);
250250
Recycle(m);
251251
}
252252

253-
void *Allocate(uptr size) {
253+
void *Allocate(uptr size) const {
254254
void *res = get_allocator().Allocate(cache_, size, 1);
255255
// TODO(alekseys): Consider making quarantine OOM-friendly.
256256
if (UNLIKELY(!res))
257257
ReportOutOfMemory(size, stack_);
258258
return res;
259259
}
260260

261-
void Deallocate(void *p) {
262-
get_allocator().Deallocate(cache_, p);
263-
}
261+
void Deallocate(void *p) const { get_allocator().Deallocate(cache_, p); }
264262

265263
private:
266264
AllocatorCache* const cache_;

0 commit comments

Comments
 (0)