[compiler-rt] bd4bf49 - [NFC][asan] Add const to QuarantineCallback methods
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 22 10:39:55 PDT 2023
Author: Vitaly Buka
Date: 2023-06-22T10:38:40-07:00
New Revision: bd4bf4947ca98cf4de0ac987833545da06209793
URL: https://github.com/llvm/llvm-project/commit/bd4bf4947ca98cf4de0ac987833545da06209793
DIFF: https://github.com/llvm/llvm-project/commit/bd4bf4947ca98cf4de0ac987833545da06209793.diff
LOG: [NFC][asan] Add const to QuarantineCallback methods
Added:
Modified:
compiler-rt/lib/asan/asan_allocator.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/asan/asan_allocator.cpp b/compiler-rt/lib/asan/asan_allocator.cpp
index 26f29486184ab..70c6cbef4c0d4 100644
--- a/compiler-rt/lib/asan/asan_allocator.cpp
+++ b/compiler-rt/lib/asan/asan_allocator.cpp
@@ -212,14 +212,14 @@ struct QuarantineCallback {
stack_(stack) {
}
- void PreQuarantine(AsanChunk *m) {
+ void PreQuarantine(AsanChunk *m) const {
FillChunk(m);
// Poison the region.
PoisonShadow(m->Beg(), RoundUpTo(m->UsedSize(), ASAN_SHADOW_GRANULARITY),
kAsanHeapFreeMagic);
}
- void Recycle(AsanChunk *m) {
+ void Recycle(AsanChunk *m) const {
void *p = get_allocator().GetBlockBegin(m);
if (p != m) {
// Clear the magic value, as allocator internals may overwrite the
@@ -244,13 +244,13 @@ struct QuarantineCallback {
get_allocator().Deallocate(cache_, p);
}
- void RecyclePassThrough(AsanChunk *m) {
+ void RecyclePassThrough(AsanChunk *m) const {
// TODO: We don't need all these here.
PreQuarantine(m);
Recycle(m);
}
- void *Allocate(uptr size) {
+ void *Allocate(uptr size) const {
void *res = get_allocator().Allocate(cache_, size, 1);
// TODO(alekseys): Consider making quarantine OOM-friendly.
if (UNLIKELY(!res))
@@ -258,9 +258,7 @@ struct QuarantineCallback {
return res;
}
- void Deallocate(void *p) {
- get_allocator().Deallocate(cache_, p);
- }
+ void Deallocate(void *p) const { get_allocator().Deallocate(cache_, p); }
private:
AllocatorCache* const cache_;
More information about the llvm-commits
mailing list