diff options
author | Dan Liew <dan@su-root.co.uk> | 2018-12-21 21:41:31 +0000 |
---|---|---|
committer | Dan Liew <dan@su-root.co.uk> | 2018-12-21 21:41:31 +0000 |
commit | cf2bf1bb77ba5acc73b036f5e943ae7e0dae4342 (patch) | |
tree | 4c61096e32d08e68b9d434e3227b11b2367c0967 /lib/sanitizer_common/sanitizer_allocator_primary32.h | |
parent | ab629b8cfbda327ff4f131760aaaae3011df8b40 (diff) | |
download | compiler-rt-cf2bf1bb77ba5acc73b036f5e943ae7e0dae4342.tar.gz |
Fix `static_assert()` scope in `SizeClassAllocator32`.
It should be at the class scope and not inside the `Init(...)` function
because we want to error out as soon as the wrong type is constructed.
At the function scope the `static_assert` is only checked if the
function might be called.
This is a follow up to r349138.
rdar://problem/45284065
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@349959 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_allocator_primary32.h')
-rw-r--r-- | lib/sanitizer_common/sanitizer_allocator_primary32.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/sanitizer_common/sanitizer_allocator_primary32.h b/lib/sanitizer_common/sanitizer_allocator_primary32.h index e5d637665..abaac3d1a 100644 --- a/lib/sanitizer_common/sanitizer_allocator_primary32.h +++ b/lib/sanitizer_common/sanitizer_allocator_primary32.h @@ -57,6 +57,10 @@ class SizeClassAllocator32 { typedef typename Params::ByteMap ByteMap; typedef typename Params::MapUnmapCallback MapUnmapCallback; + static_assert( + is_same<typename ByteMap::AddressSpaceView, AddressSpaceView>::value, + "AddressSpaceView type mismatch"); + static const bool kRandomShuffleChunks = Params::kFlags & SizeClassAllocator32FlagMasks::kRandomShuffleChunks; static const bool kUseSeparateSizeClassForBatch = Params::kFlags & @@ -109,9 +113,6 @@ class SizeClassAllocator32 { typedef SizeClassAllocator32LocalCache<ThisT> AllocatorCache; void Init(s32 release_to_os_interval_ms) { - static_assert( - is_same<typename ByteMap::AddressSpaceView, AddressSpaceView>::value, - "AddressSpaceView type mismatch"); possible_regions.Init(); internal_memset(size_class_info_array, 0, sizeof(size_class_info_array)); } |