[libcxx] Fix detection of __is_final.

Summary: Currently we only enable the use of __is_final(...) with Clang. GCC also provides __is_final(...) since 4.7 in all standard modes. This patch creates the macro _LIBCPP_HAS_IS_FINAL to note the availability of `__is_final`.

Reviewers: danalbert, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D8795

llvm-svn: 239664
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: ee187e247bc2c7b97eb345e1de7f5ccf151e24e5
diff --git a/include/exception b/include/exception
index 39d251e..5a905e7 100644
--- a/include/exception
+++ b/include/exception
@@ -195,9 +195,7 @@
 throw_with_nested(_Tp&& __t, typename enable_if<
                   is_class<typename remove_reference<_Tp>::type>::value &&
                   !is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
-#if _LIBCPP_STD_VER > 11 && __has_feature(is_final)
-                  && !is_final<typename remove_reference<_Tp>::type>::value
-#endif
+                  && !__libcpp_is_final<typename remove_reference<_Tp>::type>::value
                                     >::type* = 0)
 #else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 throw_with_nested (_Tp& __t, typename enable_if<
@@ -217,9 +215,7 @@
 throw_with_nested(_Tp&& __t, typename enable_if<
                   !is_class<typename remove_reference<_Tp>::type>::value ||
                   is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
-#if _LIBCPP_STD_VER > 11 && __has_feature(is_final)
-                  || is_final<typename remove_reference<_Tp>::type>::value
-#endif
+                  || __libcpp_is_final<typename remove_reference<_Tp>::type>::value
                                     >::type* = 0)
 #else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 throw_with_nested (_Tp& __t, typename enable_if<