[PATCH] D121849: [scudo][NFC] Rename local variables to avoid shadowing class members

Dominic Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 16 14:06:35 PDT 2022


ddcc created this revision.
ddcc added reviewers: vitalybuka, eugenis, cryptoad, mcgrathr, hctim.
Herald added a project: All.
ddcc requested review of this revision.
Herald added a project: Sanitizers.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121849

Files:
  compiler-rt/lib/scudo/standalone/quarantine.h
  compiler-rt/lib/scudo/standalone/release.h


Index: compiler-rt/lib/scudo/standalone/release.h
===================================================================
--- compiler-rt/lib/scudo/standalone/release.h
+++ compiler-rt/lib/scudo/standalone/release.h
@@ -17,8 +17,8 @@
 
 class ReleaseRecorder {
 public:
-  ReleaseRecorder(uptr Base, MapPlatformData *Data = nullptr)
-      : Base(Base), Data(Data) {}
+  ReleaseRecorder(uptr _Base, MapPlatformData *_Data = nullptr)
+      : Base(_Base), Data(_Data) {}
 
   uptr getReleasedRangesCount() const { return ReleasedRangesCount; }
 
@@ -145,8 +145,8 @@
 
 template <class ReleaseRecorderT> class FreePagesRangeTracker {
 public:
-  explicit FreePagesRangeTracker(ReleaseRecorderT *Recorder)
-      : Recorder(Recorder), PageSizeLog(getLog2(getPageSizeCached())) {}
+  explicit FreePagesRangeTracker(ReleaseRecorderT *_Recorder)
+      : Recorder(_Recorder), PageSizeLog(getLog2(getPageSizeCached())) {}
 
   void processNextPage(bool Freed) {
     if (Freed) {
Index: compiler-rt/lib/scudo/standalone/quarantine.h
===================================================================
--- compiler-rt/lib/scudo/standalone/quarantine.h
+++ compiler-rt/lib/scudo/standalone/quarantine.h
@@ -24,19 +24,19 @@
   u32 Count;
   void *Batch[MaxCount];
 
-  void init(void *Ptr, uptr Size) {
+  void init(void *Ptr, uptr Sz) {
     Count = 1;
     Batch[0] = Ptr;
-    this->Size = Size + sizeof(QuarantineBatch); // Account for the Batch Size.
+    this->Size = Sz + sizeof(QuarantineBatch); // Account for the Batch Size.
   }
 
   // The total size of quarantined nodes recorded in this batch.
   uptr getQuarantinedSize() const { return Size - sizeof(QuarantineBatch); }
 
-  void push_back(void *Ptr, uptr Size) {
+  void push_back(void *Ptr, uptr Sz) {
     DCHECK_LT(Count, MaxCount);
     Batch[Count++] = Ptr;
-    this->Size += Size;
+    this->Size += Sz;
   }
 
   bool canMerge(const QuarantineBatch *const From) const {
@@ -71,16 +71,16 @@
   // Memory used for internal accounting.
   uptr getOverheadSize() const { return List.size() * sizeof(QuarantineBatch); }
 
-  void enqueue(Callback Cb, void *Ptr, uptr Size) {
+  void enqueue(Callback Cb, void *Ptr, uptr Sz) {
     if (List.empty() || List.back()->Count == QuarantineBatch::MaxCount) {
       QuarantineBatch *B =
           reinterpret_cast<QuarantineBatch *>(Cb.allocate(sizeof(*B)));
       DCHECK(B);
-      B->init(Ptr, Size);
+      B->init(Ptr, Sz);
       enqueueBatch(B);
     } else {
-      List.back()->push_back(Ptr, Size);
-      addToSize(Size);
+      List.back()->push_back(Ptr, Sz);
+      addToSize(Sz);
     }
   }
 
@@ -242,7 +242,7 @@
   atomic_uptr MaxSize = {};
   alignas(SCUDO_CACHE_LINE_SIZE) atomic_uptr MaxCacheSize = {};
 
-  void NOINLINE recycle(uptr MinSize, Callback Cb) {
+  void NOINLINE recycle(uptr MinSz, Callback Cb) {
     CacheT Tmp;
     Tmp.init();
     {
@@ -266,7 +266,7 @@
       }
       // Extract enough chunks from the quarantine to get below the max
       // quarantine size and leave some leeway for the newly quarantined chunks.
-      while (Cache.getSize() > MinSize)
+      while (Cache.getSize() > MinSz)
         Tmp.enqueueBatch(Cache.dequeueBatch());
     }
     RecycleMutex.unlock();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121849.415972.patch
Type: text/x-patch
Size: 3220 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220316/0c1d9e03/attachment.bin>


More information about the llvm-commits mailing list