Commit fcbc2e83 authored by Jeremy Roman's avatar Jeremy Roman Committed by Commit Bot

Replace WTF::IsTriviallyDestructible with std::is_trivially_destructible.

Bug: 783060
Change-Id: I02ab0eb7aa0f540a68be1ddfc34c1b4fc16de8e2
Reviewed-on: https://chromium-review.googlesource.com/c/1347060
Commit-Queue: Yuta Kitamura <yutak@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarYuta Kitamura <yutak@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610308}
parent 1feb34d3
......@@ -77,7 +77,7 @@ template <typename T, typename Allocator>
struct FinalizerTrait<WTF::ListHashSetNode<T, Allocator>> {
STATIC_ONLY(FinalizerTrait);
static const bool kNonTrivialFinalizer =
!WTF::IsTriviallyDestructible<T>::value;
!std::is_trivially_destructible<T>::value;
static void Finalize(void* obj) {
FinalizerTraitImpl<WTF::ListHashSetNode<T, Allocator>,
kNonTrivialFinalizer>::Finalize(obj);
......@@ -110,7 +110,7 @@ template <typename Table>
struct FinalizerTrait<HeapHashTableBacking<Table>> {
STATIC_ONLY(FinalizerTrait);
static const bool kNonTrivialFinalizer =
!WTF::IsTriviallyDestructible<typename Table::ValueType>::value;
!std::is_trivially_destructible<typename Table::ValueType>::value;
static void Finalize(void* obj) {
FinalizerTraitImpl<HeapHashTableBacking<Table>,
kNonTrivialFinalizer>::Finalize(obj);
......
......@@ -390,7 +390,9 @@ void HeapVectorBacking<T, Traits>::Finalize(void* pointer) {
"HeapVectorBacking doesn't support objects that cannot be cleared as "
"unused with memset or don't have a vtable");
DCHECK(!WTF::IsTriviallyDestructible<T>::value);
static_assert(
!std::is_trivially_destructible<T>::value,
"Finalization of trivially destructible classes should not happen.");
HeapObjectHeader* header = HeapObjectHeader::FromPayload(pointer);
// Use the payload size as recorded by the heap to determine how many
// elements to finalize.
......@@ -417,7 +419,9 @@ void HeapVectorBacking<T, Traits>::Finalize(void* pointer) {
template <typename Table>
void HeapHashTableBacking<Table>::Finalize(void* pointer) {
using Value = typename Table::ValueType;
DCHECK(!WTF::IsTriviallyDestructible<Value>::value);
static_assert(
!std::is_trivially_destructible<Value>::value,
"Finalization of trivially destructible classes should not happen.");
HeapObjectHeader* header = HeapObjectHeader::FromPayload(pointer);
// Use the payload size as recorded by the heap to determine how many
// elements to finalize.
......
......@@ -1651,7 +1651,7 @@ void HashTable<Key,
KeyTraits,
Allocator>::DeleteAllBucketsAndDeallocate(ValueType* table,
unsigned size) {
if (!IsTriviallyDestructible<ValueType>::value) {
if (!std::is_trivially_destructible<ValueType>::value) {
for (unsigned i = 0; i < size; ++i) {
// This code is called when the hash table is cleared or resized. We
// have allocated a new backing store and we need to run the
......
......@@ -416,7 +416,7 @@ class ListHashSetNode : public ListHashSetNodeBase<ValueArg> {
void SetWasAlreadyDestructed() {
if (NodeAllocator::kIsGarbageCollected &&
!IsTriviallyDestructible<ValueArg>::value)
!std::is_trivially_destructible<ValueArg>::value)
this->prev_ = UnlinkedNodePointer();
}
......@@ -427,7 +427,9 @@ class ListHashSetNode : public ListHashSetNodeBase<ValueArg> {
static void Finalize(void* pointer) {
// No need to waste time calling finalize if it's not needed.
DCHECK(!IsTriviallyDestructible<ValueArg>::value);
static_assert(
!std::is_trivially_destructible<ValueArg>::value,
"Finalization of trivially destructible classes should not happen.");
ListHashSetNode* self = reinterpret_cast_ptr<ListHashSetNode*>(pointer);
// Check whether this node was already destructed before being unlinked
......
......@@ -48,14 +48,6 @@ enum WeakHandlingFlag {
kWeakHandling,
};
template <typename T>
struct IsTriviallyDestructible {
// TODO(slangley): crbug.com/783060 - std::is_trivially_destructible behaves
// differently on across platforms.
static constexpr bool value =
__has_trivial_destructor(T) && std::is_destructible<T>::value;
};
template <typename T, typename U>
struct IsSubclass {
private:
......
......@@ -217,7 +217,7 @@ static_assert(
!std::is_trivially_default_constructible<DefaultConstructorDeleted>::value,
"DefaultConstructorDeleted must not be trivially default constructible.");
static_assert(!IsTriviallyDestructible<DestructorDeleted>::value,
static_assert(!std::is_trivially_destructible<DestructorDeleted>::value,
"DestructorDeleted must not be trivially destructible.");
#define EnsurePtrConvertibleArgDecl(From, To) \
......
......@@ -32,7 +32,8 @@ namespace WTF {
template <typename T>
struct VectorTraitsBase {
static const bool kNeedsDestruction = !IsTriviallyDestructible<T>::value;
static const bool kNeedsDestruction =
!std::is_trivially_destructible<T>::value;
static constexpr bool kCanInitializeWithMemset =
std::is_trivially_default_constructible<T>::value;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment