Index: compiler-rt/trunk/lib/asan/asan_allocator.h =================================================================== --- compiler-rt/trunk/lib/asan/asan_allocator.h +++ compiler-rt/trunk/lib/asan/asan_allocator.h @@ -184,10 +184,6 @@ #endif // SANITIZER_CAN_USE_ALLOCATOR64 static const uptr kNumberOfSizeClasses = SizeClassMap::kNumClasses; -template -using AllocatorCacheASVT = - SizeClassAllocatorLocalCache>; -using AllocatorCache = AllocatorCacheASVT; template using SecondaryAllocatorASVT = @@ -196,10 +192,10 @@ template using AsanAllocatorASVT = CombinedAllocator, - AllocatorCacheASVT, SecondaryAllocatorASVT, AddressSpaceView>; using AsanAllocator = AsanAllocatorASVT; +using AllocatorCache = AsanAllocator::AllocatorCache; struct AsanThreadLocalMallocStorage { uptr quarantine_cache[16]; Index: compiler-rt/trunk/lib/hwasan/hwasan_allocator.h =================================================================== --- compiler-rt/trunk/lib/hwasan/hwasan_allocator.h +++ compiler-rt/trunk/lib/hwasan/hwasan_allocator.h @@ -61,10 +61,9 @@ static const uptr kFlags = 0; }; typedef SizeClassAllocator64 PrimaryAllocator; -typedef SizeClassAllocatorLocalCache AllocatorCache; typedef LargeMmapAllocator SecondaryAllocator; -typedef CombinedAllocator Allocator; +typedef CombinedAllocator Allocator; +typedef Allocator::AllocatorCache AllocatorCache; void AllocatorSwallowThreadLocalCache(AllocatorCache *cache); Index: compiler-rt/trunk/lib/lsan/lsan_allocator.h =================================================================== --- compiler-rt/trunk/lib/lsan/lsan_allocator.h +++ compiler-rt/trunk/lib/lsan/lsan_allocator.h @@ -90,11 +90,6 @@ #endif template -using AllocatorCacheASVT = - SizeClassAllocatorLocalCache>; -using AllocatorCache = AllocatorCacheASVT; - -template using SecondaryAllocatorASVT = LargeMmapAllocator; @@ -102,12 +97,12 @@ template using AllocatorASVT = CombinedAllocator, - AllocatorCacheASVT, SecondaryAllocatorASVT, AddressSpaceView>; using Allocator = AllocatorASVT; +using AllocatorCache = Allocator::AllocatorCache; -AllocatorCache *GetAllocatorCache(); +Allocator::AllocatorCache *GetAllocatorCache(); int lsan_posix_memalign(void **memptr, uptr alignment, uptr size, const StackTrace &stack); Index: compiler-rt/trunk/lib/msan/msan_allocator.cc =================================================================== --- compiler-rt/trunk/lib/msan/msan_allocator.cc +++ compiler-rt/trunk/lib/msan/msan_allocator.cc @@ -108,10 +108,9 @@ }; typedef SizeClassAllocator32 PrimaryAllocator; #endif -typedef SizeClassAllocatorLocalCache AllocatorCache; typedef LargeMmapAllocator SecondaryAllocator; -typedef CombinedAllocator Allocator; +typedef CombinedAllocator Allocator; +typedef Allocator::AllocatorCache AllocatorCache; static Allocator allocator; static AllocatorCache fallback_allocator_cache; Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_combined.h =================================================================== --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_combined.h +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_combined.h @@ -19,11 +19,11 @@ // When allocating 2^x bytes it should return 2^x aligned chunk. // PrimaryAllocator is used via a local AllocatorCache. // SecondaryAllocator can allocate anything, but is not efficient. -template // NOLINT class CombinedAllocator { public: + using AllocatorCache = SizeClassAllocatorLocalCache; using AddressSpaceView = AddressSpaceViewTy; static_assert(is_same::value, Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_internal.h =================================================================== --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_internal.h +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_internal.h @@ -34,15 +34,13 @@ }; typedef SizeClassAllocator32 PrimaryInternalAllocator; -typedef SizeClassAllocatorLocalCache - InternalAllocatorCache; - typedef LargeMmapAllocator SecondaryInternalAllocator; -typedef CombinedAllocator InternalAllocator; +typedef CombinedAllocator + InternalAllocator; +typedef InternalAllocator::AllocatorCache InternalAllocatorCache; void *InternalAlloc(uptr size, InternalAllocatorCache *cache = nullptr, uptr alignment = 0); Index: compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator_test.cc =================================================================== --- compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator_test.cc +++ compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator_test.cc @@ -615,17 +615,14 @@ a.Deallocate(&stats, p); } -template - +template void TestCombinedAllocator() { - typedef - CombinedAllocator - Allocator; + typedef CombinedAllocator Allocator; Allocator *a = new Allocator; a->Init(kReleaseToOSIntervalNever); std::mt19937 r; - AllocatorCache cache; + typename Allocator::AllocatorCache cache; memset(&cache, 0, sizeof(cache)); a->InitCache(&cache); @@ -686,36 +683,26 @@ #if SANITIZER_CAN_USE_ALLOCATOR64 TEST(SanitizerCommon, CombinedAllocator64) { - TestCombinedAllocator, - SizeClassAllocatorLocalCache > (); + TestCombinedAllocator>(); } TEST(SanitizerCommon, CombinedAllocator64Dynamic) { - TestCombinedAllocator, - SizeClassAllocatorLocalCache > (); + TestCombinedAllocator>(); } #if !SANITIZER_ANDROID TEST(SanitizerCommon, CombinedAllocator64Compact) { - TestCombinedAllocator, - SizeClassAllocatorLocalCache > (); + TestCombinedAllocator>(); } #endif TEST(SanitizerCommon, CombinedAllocator64VeryCompact) { - TestCombinedAllocator, - SizeClassAllocatorLocalCache > (); + TestCombinedAllocator>(); } #endif TEST(SanitizerCommon, CombinedAllocator32Compact) { - TestCombinedAllocator, - SizeClassAllocatorLocalCache > (); + TestCombinedAllocator>(); } template Index: compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator_testlib.cc =================================================================== --- compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator_testlib.cc +++ compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator_testlib.cc @@ -49,10 +49,9 @@ namespace { typedef SizeClassAllocator64<__AP64> PrimaryAllocator; -typedef SizeClassAllocatorLocalCache AllocatorCache; typedef LargeMmapAllocator<> SecondaryAllocator; -typedef CombinedAllocator Allocator; +typedef CombinedAllocator Allocator; +typedef Allocator::AllocatorCache AllocatorCache; static Allocator allocator; static bool global_inited; Index: compiler-rt/trunk/lib/scudo/scudo_allocator.h =================================================================== --- compiler-rt/trunk/lib/scudo/scudo_allocator.h +++ compiler-rt/trunk/lib/scudo/scudo_allocator.h @@ -102,9 +102,9 @@ #include "scudo_allocator_secondary.h" #include "scudo_allocator_combined.h" -typedef SizeClassAllocatorLocalCache AllocatorCacheT; typedef LargeMmapAllocator SecondaryT; -typedef CombinedAllocator BackendT; +typedef CombinedAllocator BackendT; +typedef BackendT::AllocatorCache AllocatorCacheT; void initScudo(); Index: compiler-rt/trunk/lib/scudo/scudo_allocator_combined.h =================================================================== --- compiler-rt/trunk/lib/scudo/scudo_allocator_combined.h +++ compiler-rt/trunk/lib/scudo/scudo_allocator_combined.h @@ -18,10 +18,10 @@ # error "This file must be included inside scudo_allocator.h." #endif -template +template class CombinedAllocator { public: + using AllocatorCache = typename PrimaryAllocator::AllocatorCache; void init(s32 ReleaseToOSIntervalMs) { Primary.Init(ReleaseToOSIntervalMs); Secondary.Init(); Index: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h =================================================================== --- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h +++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h @@ -79,10 +79,9 @@ }; typedef SizeClassAllocator64 PrimaryAllocator; #endif -typedef SizeClassAllocatorLocalCache AllocatorCache; typedef LargeMmapAllocator SecondaryAllocator; -typedef CombinedAllocator Allocator; +typedef CombinedAllocator Allocator; +typedef Allocator::AllocatorCache AllocatorCache; Allocator *allocator(); #endif