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 @@ -192,11 +192,21 @@ #endif // SANITIZER_CAN_USE_ALLOCATOR64 static const uptr kNumberOfSizeClasses = SizeClassMap::kNumClasses; -typedef SizeClassAllocatorLocalCache AllocatorCache; -typedef LargeMmapAllocator SecondaryAllocator; -typedef CombinedAllocator AsanAllocator; +template +using AllocatorCacheASVT = + SizeClassAllocatorLocalCache>; +using AllocatorCache = AllocatorCacheASVT; +template +using SecondaryAllocatorASVT = + LargeMmapAllocator; +template +using AsanAllocatorASVT = + CombinedAllocator, + AllocatorCacheASVT, + SecondaryAllocatorASVT>; +using AsanAllocator = AsanAllocatorASVT; struct AsanThreadLocalMallocStorage { uptr quarantine_cache[16]; 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 @@ -96,7 +96,23 @@ using PrimaryAllocatorASVT = SizeClassAllocator64>; using PrimaryAllocator = PrimaryAllocatorASVT; #endif -typedef SizeClassAllocatorLocalCache AllocatorCache; + +template +using AllocatorCacheASVT = + SizeClassAllocatorLocalCache>; +using AllocatorCache = AllocatorCacheASVT; + +template +using SecondaryAllocatorASVT = + LargeMmapAllocator; + +template +using AllocatorASVT = + CombinedAllocator, + AllocatorCacheASVT, + SecondaryAllocatorASVT>; +using Allocator = AllocatorASVT; AllocatorCache *GetAllocatorCache(); Index: compiler-rt/trunk/lib/lsan/lsan_allocator.cc =================================================================== --- compiler-rt/trunk/lib/lsan/lsan_allocator.cc +++ compiler-rt/trunk/lib/lsan/lsan_allocator.cc @@ -34,9 +34,6 @@ #else static const uptr kMaxAllowedMallocSize = 8UL << 30; #endif -typedef LargeMmapAllocator<> SecondaryAllocator; -typedef CombinedAllocator Allocator; static Allocator allocator; 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 @@ -21,9 +21,11 @@ // PrimaryAllocator is used via a local AllocatorCache. // SecondaryAllocator can allocate anything, but is not efficient. template // NOLINT + class SecondaryAllocator, + typename AddressSpaceViewTy = LocalAddressSpaceView> // NOLINT class CombinedAllocator { public: + using AddressSpaceView = AddressSpaceViewTy; void InitLinkerInitialized(s32 release_to_os_interval_ms) { primary_.Init(release_to_os_interval_ms); secondary_.InitLinkerInitialized(); @@ -31,6 +33,12 @@ } void Init(s32 release_to_os_interval_ms) { + static_assert(is_same::value, + "PrimaryAllocator is using wrong AddressSpaceView"); + static_assert(is_same::value, + "SecondaryAllocator is using wrong AddressSpaceView"); primary_.Init(release_to_os_interval_ms); secondary_.Init(); stats_.Init(); @@ -194,4 +202,3 @@ SecondaryAllocator secondary_; AllocatorGlobalStats stats_; }; - Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_secondary.h =================================================================== --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_secondary.h +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_secondary.h @@ -69,9 +69,10 @@ // sizes not covered by more efficient allocators (e.g. SizeClassAllocator64). template + class AddressSpaceViewTy = LocalAddressSpaceView> class LargeMmapAllocator { public: + using AddressSpaceView = AddressSpaceViewTy; void InitLinkerInitialized() { page_size_ = GetPageSizeCached(); chunks_ = reinterpret_cast(ptr_array_.Init());