[HWASAN][NFC] Renamed [g|s]et_requested_size to [G|S]etRequestedSize.
authorKirill Stoimenov <kstoimenov@google.com>
Fri, 9 Dec 2022 18:53:54 +0000 (18:53 +0000)
committerKirill Stoimenov <kstoimenov@google.com>
Mon, 12 Dec 2022 19:23:19 +0000 (19:23 +0000)
Reviewed By: kda

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

compiler-rt/lib/hwasan/hwasan_allocator.cpp
compiler-rt/lib/hwasan/hwasan_allocator.h

index 0f7a0ac..102c2bd 100644 (file)
@@ -43,7 +43,7 @@ static ALIGNED(16) u8 tail_magic[kShadowAlignment - 1];
 
 bool HwasanChunkView::IsAllocated() const {
   return metadata_ && metadata_->alloc_context_id &&
-         metadata_->get_requested_size();
+         metadata_->GetRequestedSize();
 }
 
 uptr HwasanChunkView::Beg() const {
@@ -53,7 +53,7 @@ uptr HwasanChunkView::End() const {
   return Beg() + UsedSize();
 }
 uptr HwasanChunkView::UsedSize() const {
-  return metadata_->get_requested_size();
+  return metadata_->GetRequestedSize();
 }
 u32 HwasanChunkView::GetAllocStackId() const {
   return metadata_->alloc_context_id;
@@ -148,7 +148,7 @@ static void *HwasanAllocate(StackTrace *stack, uptr orig_size, uptr alignment,
   }
   Metadata *meta =
       reinterpret_cast<Metadata *>(allocator.GetMetaData(allocated));
-  meta->set_requested_size(orig_size);
+  meta->SetRequestedSize(orig_size);
   meta->alloc_context_id = StackDepotPut(*stack);
   if (zeroise) {
     internal_memset(allocated, 0, size);
@@ -234,7 +234,7 @@ static void HwasanDeallocate(StackTrace *stack, void *tagged_ptr) {
     ReportInvalidFree(stack, reinterpret_cast<uptr>(tagged_ptr));
     return;
   }
-  uptr orig_size = meta->get_requested_size();
+  uptr orig_size = meta->GetRequestedSize();
   u32 free_context_id = StackDepotPut(*stack);
   u32 alloc_context_id = meta->alloc_context_id;
 
@@ -255,7 +255,7 @@ static void HwasanDeallocate(StackTrace *stack, void *tagged_ptr) {
                             orig_size, tail_magic);
   }
 
-  meta->set_requested_size(0);
+  meta->SetRequestedSize(0);
   meta->alloc_context_id = 0;
   // This memory will not be reused by anyone else, so we are free to keep it
   // poisoned.
@@ -312,7 +312,7 @@ static void *HwasanReallocate(StackTrace *stack, void *tagged_ptr_old,
         reinterpret_cast<Metadata *>(allocator.GetMetaData(untagged_ptr_old));
     internal_memcpy(
         UntagPtr(tagged_ptr_new), untagged_ptr_old,
-        Min(new_size, static_cast<uptr>(meta->get_requested_size())));
+        Min(new_size, static_cast<uptr>(meta->GetRequestedSize())));
     HwasanDeallocate(stack, tagged_ptr_old);
   }
   return tagged_ptr_new;
@@ -344,7 +344,7 @@ static uptr AllocationSize(const void *tagged_ptr) {
   const void *beg = allocator.GetBlockBegin(untagged_ptr);
   Metadata *b = (Metadata *)allocator.GetMetaData(untagged_ptr);
   if (beg != untagged_ptr) return 0;
-  return b->get_requested_size();
+  return b->GetRequestedSize();
 }
 
 void *hwasan_malloc(uptr size, StackTrace *stack) {
index c38b28d..396abf2 100644 (file)
@@ -34,10 +34,10 @@ struct Metadata {
   u32 requested_size_low;
   u32 requested_size_high;
   u32 alloc_context_id;
-  u64 get_requested_size() {
+  u64 GetRequestedSize() {
     return (static_cast<u64>(requested_size_high) << 32) + requested_size_low;
   }
-  void set_requested_size(u64 size) {
+  void SetRequestedSize(u64 size) {
     requested_size_low = size & ((1ul << 32) - 1);
     requested_size_high = size >> 32;
   }