[compiler-rt] r331662 - [sanitizer] s/TestOnlyInit/Init for the allocator ByteMap (NFC)

Kostya Kortchinsky via llvm-commits llvm-commits at lists.llvm.org
Mon May 7 12:02:19 PDT 2018


Author: cryptoad
Date: Mon May  7 12:02:19 2018
New Revision: 331662

URL: http://llvm.org/viewvc/llvm-project?rev=331662&view=rev
Log:
[sanitizer] s/TestOnlyInit/Init for the allocator ByteMap (NFC)

Summary:
The `TestOnlyInit` function of `{Flat,TwoLevel}ByteMap` seems to be a misnomer
since the function is used outside of tests as well, namely in
`SizeClassAllocator32::Init`. Rename it to `Init` and update the callers.

Reviewers: alekseyshl, vitalybuka

Reviewed By: vitalybuka

Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits

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

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_bytemap.h
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_primary32.h
    compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator_test.cc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_bytemap.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_bytemap.h?rev=331662&r1=331661&r2=331662&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_bytemap.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_bytemap.h Mon May  7 12:02:19 2018
@@ -18,7 +18,7 @@
 template<u64 kSize>
 class FlatByteMap {
  public:
-  void TestOnlyInit() {
+  void Init() {
     internal_memset(map_, 0, sizeof(map_));
   }
 
@@ -44,7 +44,7 @@ class FlatByteMap {
 template <u64 kSize1, u64 kSize2, class MapUnmapCallback = NoOpMapUnmapCallback>
 class TwoLevelByteMap {
  public:
-  void TestOnlyInit() {
+  void Init() {
     internal_memset(map1_, 0, sizeof(map1_));
     mu_.Init();
   }

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_primary32.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_primary32.h?rev=331662&r1=331661&r2=331662&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_primary32.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_primary32.h Mon May  7 12:02:19 2018
@@ -108,7 +108,7 @@ class SizeClassAllocator32 {
   typedef SizeClassAllocator32LocalCache<ThisT> AllocatorCache;
 
   void Init(s32 release_to_os_interval_ms) {
-    possible_regions.TestOnlyInit();
+    possible_regions.Init();
     internal_memset(size_class_info_array, 0, sizeof(size_class_info_array));
   }
 

Modified: compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator_test.cc?rev=331662&r1=331661&r2=331662&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator_test.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator_test.cc Mon May  7 12:02:19 2018
@@ -1289,7 +1289,7 @@ TEST(SanitizerCommon, TwoLevelByteMap) {
   const u64 kSize1 = 1 << 6, kSize2 = 1 << 12;
   const u64 n = kSize1 * kSize2;
   TwoLevelByteMap<kSize1, kSize2> m;
-  m.TestOnlyInit();
+  m.Init();
   for (u64 i = 0; i < n; i += 7) {
     m.set(i, (i % 100) + 1);
   }
@@ -1324,7 +1324,7 @@ void *TwoLevelByteMapUserThread(void *pa
 
 TEST(SanitizerCommon, ThreadedTwoLevelByteMap) {
   TestByteMap m;
-  m.TestOnlyInit();
+  m.Init();
   TestMapUnmapCallback::map_count = 0;
   TestMapUnmapCallback::unmap_count = 0;
   static const int kNumThreads = 4;




More information about the llvm-commits mailing list