summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2015-02-20 16:19:28 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2015-02-20 16:19:28 +0000
commitf4b269bdf0147402d1aee7d68db57a09640d00f6 (patch)
treedd1eadb0e903b920b2fbce461621aee501bab577 /llvm
parent263edb99ab81d8d9087278b58a39197fb18ff495 (diff)
downloadbcm5719-llvm-f4b269bdf0147402d1aee7d68db57a09640d00f6.tar.gz
bcm5719-llvm-f4b269bdf0147402d1aee7d68db57a09640d00f6.zip
Base isPodLike on is_trivially_copyable for GCC 5 and MSVC
It would be nice to get rid of the version checks here, but that will have to wait until libstdc++ is upgraded to 5.0 everywhere ... llvm-svn: 230021
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/Support/type_traits.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/include/llvm/Support/type_traits.h b/llvm/include/llvm/Support/type_traits.h
index 70953a9cb70..1befe92bb1c 100644
--- a/llvm/include/llvm/Support/type_traits.h
+++ b/llvm/include/llvm/Support/type_traits.h
@@ -28,9 +28,17 @@ namespace llvm {
/// type can be copied around with memcpy instead of running ctors etc.
template <typename T>
struct isPodLike {
-#if __has_feature(is_trivially_copyable)
+ // std::is_trivially copyable is available in libc++ with clang, libstdc++
+ // that comes with GCC 5 and MSVC 2013.
+#if (__has_feature(is_trivially_copyable) && defined(_LIBCPP_VERSION)) || \
+ (defined(__GNUC__) && __GNUC__ >= 5) || defined(_MSC_VER)
// If the compiler supports the is_trivially_copyable trait use it, as it
// matches the definition of isPodLike closely.
+ static const bool value = std::is_trivially_copyable<T>::value;
+#elif __has_feature(is_trivially_copyable)
+ // Use the internal name if the compiler supports is_trivially_copyable but we
+ // don't know if the standard library does. This is the case for clang in
+ // conjunction with libstdc++ from GCC 4.x.
static const bool value = __is_trivially_copyable(T);
#else
// If we don't know anything else, we can (at least) assume that all non-class
OpenPOWER on IntegriCloud