[compiler-rt] ee56d88 - [HWASAN][NFC] Renamed [g|s]et_requested_size to [G|S]etRequestedSize.

Kirill Stoimenov via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 12 11:23:28 PST 2022


Author: Kirill Stoimenov
Date: 2022-12-12T19:23:19Z
New Revision: ee56d88b02cb9b0185cdc1f477bffe18f1aa1c30

URL: https://github.com/llvm/llvm-project/commit/ee56d88b02cb9b0185cdc1f477bffe18f1aa1c30
DIFF: https://github.com/llvm/llvm-project/commit/ee56d88b02cb9b0185cdc1f477bffe18f1aa1c30.diff

LOG: [HWASAN][NFC] Renamed [g|s]et_requested_size to [G|S]etRequestedSize.

Reviewed By: kda

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/hwasan/hwasan_allocator.cpp b/compiler-rt/lib/hwasan/hwasan_allocator.cpp
index 0f7a0ac8f000d..102c2bdbc07f7 100644
--- a/compiler-rt/lib/hwasan/hwasan_allocator.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_allocator.cpp
@@ -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) {

diff  --git a/compiler-rt/lib/hwasan/hwasan_allocator.h b/compiler-rt/lib/hwasan/hwasan_allocator.h
index c38b28d12624b..396abf216d48e 100644
--- a/compiler-rt/lib/hwasan/hwasan_allocator.h
+++ b/compiler-rt/lib/hwasan/hwasan_allocator.h
@@ -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;
   }


        


More information about the llvm-commits mailing list