[llvm] r368910 - Use std::is_final directly

JF Bastien via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 14 13:13:49 PDT 2019


Author: jfb
Date: Wed Aug 14 13:13:49 2019
New Revision: 368910

URL: http://llvm.org/viewvc/llvm-project?rev=368910&view=rev
Log:
Use std::is_final directly

The workaround isn't needed anymore because all toolchains should support it.

Modified:
    llvm/trunk/include/llvm/Support/TrailingObjects.h
    llvm/trunk/include/llvm/Support/type_traits.h

Modified: llvm/trunk/include/llvm/Support/TrailingObjects.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/TrailingObjects.h?rev=368910&r1=368909&r2=368910&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/TrailingObjects.h (original)
+++ llvm/trunk/include/llvm/Support/TrailingObjects.h Wed Aug 14 13:13:49 2019
@@ -249,9 +249,7 @@ class TrailingObjects : private trailing
   // because BaseTy isn't complete at class instantiation time, but
   // will be by the time this function is instantiated.
   static void verifyTrailingObjectsAssertions() {
-#ifdef LLVM_IS_FINAL
-    static_assert(LLVM_IS_FINAL(BaseTy), "BaseTy must be final.");
-#endif
+    static_assert(std::is_final<BaseTy>(), "BaseTy must be final.");
   }
 
   // These two methods are the base of the recursion for this method.

Modified: llvm/trunk/include/llvm/Support/type_traits.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/type_traits.h?rev=368910&r1=368909&r2=368910&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/type_traits.h (original)
+++ llvm/trunk/include/llvm/Support/type_traits.h Wed Aug 14 13:13:49 2019
@@ -189,13 +189,4 @@ class is_trivially_copyable<T*> : public
 
 } // end namespace llvm
 
-// 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 defined(__cplusplus) || defined(_MSC_VER)
-#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
-
 #endif // LLVM_SUPPORT_TYPE_TRAITS_H




More information about the llvm-commits mailing list