diff options
author | Mike Klein <mtklein@chromium.org> | 2018-06-07 10:00:49 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-07 16:03:31 +0000 |
commit | d62c4bd38c713c65c508919e28c44c0d423ac546 (patch) | |
tree | 36a6daa2d95d9a237c9a0be8d99ffb91c157d90a | |
parent | 73e93f31349a3a59c07488249970567893f15efe (diff) |
require std::is_trivially_destructible
Change-Id: I78cbaf420ad1e16f07eacb8b4c6c825fe849b08a
Reviewed-on: https://skia-review.googlesource.com/132825
Auto-Submit: Mike Klein <mtklein@chromium.org>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
-rw-r--r-- | include/private/SkArenaAlloc.h | 4 | ||||
-rw-r--r-- | include/private/SkTLogic.h | 2 | ||||
-rw-r--r-- | src/core/SkLiteDL.cpp | 13 |
3 files changed, 6 insertions, 13 deletions
diff --git a/include/private/SkArenaAlloc.h b/include/private/SkArenaAlloc.h index b905ee5eff..12f45c9bb3 100644 --- a/include/private/SkArenaAlloc.h +++ b/include/private/SkArenaAlloc.h @@ -79,7 +79,7 @@ public: uint32_t size = SkTo<uint32_t>(sizeof(T)); uint32_t alignment = SkTo<uint32_t>(alignof(T)); char* objStart; - if (skstd::is_trivially_destructible<T>::value) { + if (std::is_trivially_destructible<T>::value) { objStart = this->allocObject(size, alignment); fCursor = objStart + size; } else { @@ -173,7 +173,7 @@ private: uint32_t arraySize = SkTo<uint32_t>(count * sizeof(T)); uint32_t alignment = SkTo<uint32_t>(alignof(T)); - if (skstd::is_trivially_destructible<T>::value) { + if (std::is_trivially_destructible<T>::value) { objStart = this->allocObject(arraySize, alignment); fCursor = objStart + arraySize; } else { diff --git a/include/private/SkTLogic.h b/include/private/SkTLogic.h index cc76d7b618..9648f9239c 100644 --- a/include/private/SkTLogic.h +++ b/include/private/SkTLogic.h @@ -60,10 +60,8 @@ template <typename... T> using common_type_t = typename std::common_type<T...>:: template <typename T> struct underlying_type { using type = __underlying_type(T); }; -template <typename T> using is_trivially_destructible = std::has_trivial_destructor<T>; #else template <typename T> using underlying_type = std::underlying_type<T>; -template <typename T> using is_trivially_destructible = std::is_trivially_destructible<T>; #endif template <typename T> using underlying_type_t = typename skstd::underlying_type<T>::type; diff --git a/src/core/SkLiteDL.cpp b/src/core/SkLiteDL.cpp index ed23acffe0..ce6f0d3191 100644 --- a/src/core/SkLiteDL.cpp +++ b/src/core/SkLiteDL.cpp @@ -706,16 +706,11 @@ typedef void(*void_fn)(const void*); static const draw_fn draw_fns[] = { TYPES(M) }; #undef M -// Older libstdc++ has pre-standard std::has_trivial_destructor. -#if defined(__GLIBCXX__) && (__GLIBCXX__ < 20130000) - template <typename T> using can_skip_destructor = std::has_trivial_destructor<T>; -#else - template <typename T> using can_skip_destructor = std::is_trivially_destructible<T>; -#endif - // Most state ops (matrix, clip, save, restore) have a trivial destructor. -#define M(T) !can_skip_destructor<T>::value ? [](const void* op) { ((const T*)op)->~T(); } \ - : (void_fn)nullptr, +#define M(T) !std::is_trivially_destructible<T>::value \ + ? [](const void* op) { ((const T*)op)->~T(); } \ + : (void_fn)nullptr, + static const void_fn dtor_fns[] = { TYPES(M) }; #undef M |