Add a TrailingObjects template class.
[oota-llvm.git] / include / llvm / Support / type_traits.h
index 1befe92bb1c4879e098c57eabfe933bad4f4caca..88385c3fae1e6fad3c7536627861f3a1885007c5 100644 (file)
@@ -28,10 +28,10 @@ namespace llvm {
 /// type can be copied around with memcpy instead of running ctors etc.
 template <typename T>
 struct isPodLike {
-  // std::is_trivially copyable is available in libc++ with clang, libstdc++
-  // that comes with GCC 5 and MSVC 2013.
+  // std::is_trivially_copyable is available in libc++ with clang, libstdc++
+  // that comes with GCC 5.
 #if (__has_feature(is_trivially_copyable) && defined(_LIBCPP_VERSION)) ||      \
-    (defined(__GNUC__) && __GNUC__ >= 5) || defined(_MSC_VER)
+    (defined(__GNUC__) && __GNUC__ >= 5)
   // 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;
@@ -93,6 +93,15 @@ struct add_const_past_pointer<
 
 }
 
+// If the compiler supports detecting whether a class is final, define
+// an LLVM_IS_FINAL macro. If it cannot be defined properly, this
+// macro will be left undefined.
+#if __cplusplus >= 201402L
+#define LLVM_IS_FINAL(Ty) std::is_final<Ty>()
+#elif __has_feature(is_final) || LLVM_GNUC_PREREQ(4, 7, 0)
+#define LLVM_IS_FINAL(Ty) __is_final(Ty)
+#endif
+
 #ifdef LLVM_DEFINED_HAS_FEATURE
 #undef __has_feature
 #endif