[libc++] Mark <filesystem> as unavailable on Apple platforms using pragmas
Summary:
Also add the corresponding XFAILs to tests that require filesystem.
The approach taken to mark <filesystem> as unavailable in this patch
is to mark all the header as unavailable using #pragma clang attribute.
Marking each declaration using the attribute is more intrusive and
does not provide a lot of value right now because pretty much everything
in <filesystem> requires dylib support, often transitively.
This is an alternative to https://reviews.llvm.org/D59093.
A similar (but partial) patch was already applied in r356558.
Reviewers: mclow.lists, EricWF, serge-sans-paille
Subscribers: christof, jkorous, dexonsmith, libcxx-commits
Differential Revision: https://reviews.llvm.org/D59224
llvm-svn: 356616
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: fa0573027f4a24b4dd356e002055ed2818b915a1
diff --git a/include/filesystem b/include/filesystem
index d599b54..3aaa798 100644
--- a/include/filesystem
+++ b/include/filesystem
@@ -258,6 +258,8 @@
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
+_LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
+
typedef chrono::time_point<_FilesystemClock> file_time_type;
struct _LIBCPP_TYPE_VIS space_info {
@@ -1310,7 +1312,11 @@
return !(__lhs == __rhs);
}
-class _LIBCPP_EXCEPTION_ABI filesystem_error : public system_error {
+// TODO(ldionne): We need to pop the pragma and push it again after
+// filesystem_error to work around PR41078.
+_LIBCPP_AVAILABILITY_FILESYSTEM_POP
+
+class _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_EXCEPTION_ABI filesystem_error : public system_error {
public:
_LIBCPP_INLINE_VISIBILITY
filesystem_error(const string& __what, error_code __ec)
@@ -1361,6 +1367,8 @@
shared_ptr<_Storage> __storage_;
};
+_LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
+
template <class... _Args>
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -2624,6 +2632,8 @@
return recursive_directory_iterator();
}
+_LIBCPP_AVAILABILITY_FILESYSTEM_POP
+
_LIBCPP_END_NAMESPACE_FILESYSTEM
#endif // !_LIBCPP_CXX03_LANG