forked from OSchip/llvm-project
Fix `static_assert()` scope in `CombinedAllocator`.
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 r349957. rdar://problem/45284065 llvm-svn: 349960
This commit is contained in:
parent
09f6d77840
commit
a8334ed571
|
@ -26,6 +26,13 @@ template <class PrimaryAllocator, class AllocatorCache,
|
|||
class CombinedAllocator {
|
||||
public:
|
||||
using AddressSpaceView = AddressSpaceViewTy;
|
||||
static_assert(is_same<AddressSpaceView,
|
||||
typename PrimaryAllocator::AddressSpaceView>::value,
|
||||
"PrimaryAllocator is using wrong AddressSpaceView");
|
||||
static_assert(is_same<AddressSpaceView,
|
||||
typename SecondaryAllocator::AddressSpaceView>::value,
|
||||
"SecondaryAllocator is using wrong AddressSpaceView");
|
||||
|
||||
void InitLinkerInitialized(s32 release_to_os_interval_ms) {
|
||||
primary_.Init(release_to_os_interval_ms);
|
||||
secondary_.InitLinkerInitialized();
|
||||
|
@ -33,12 +40,6 @@ class CombinedAllocator {
|
|||
}
|
||||
|
||||
void Init(s32 release_to_os_interval_ms) {
|
||||
static_assert(is_same<AddressSpaceView,
|
||||
typename PrimaryAllocator::AddressSpaceView>::value,
|
||||
"PrimaryAllocator is using wrong AddressSpaceView");
|
||||
static_assert(is_same<AddressSpaceView,
|
||||
typename SecondaryAllocator::AddressSpaceView>::value,
|
||||
"SecondaryAllocator is using wrong AddressSpaceView");
|
||||
primary_.Init(release_to_os_interval_ms);
|
||||
secondary_.Init();
|
||||
stats_.Init();
|
||||
|
|
Loading…
Reference in New Issue