Implement <filesystem>
This patch implements the <filesystem> header and uses that
to provide <experimental/filesystem>.
Unlike other standard headers, the symbols needed for <filesystem>
have not yet been placed in libc++.so. Instead they live in the
new libc++fs.a library. Users of filesystem are required to link this
library. (Also note that libc++experimental no longer contains the
definition of <experimental/filesystem>, which now requires linking libc++fs).
The reason for keeping <filesystem> out of the dylib for now is that
it's still somewhat experimental, and the possibility of requiring an
ABI breaking change is very real. In the future the symbols will likely
be moved into the dylib, or the dylib will be made to link libc++fs automagically).
Note that moving the symbols out of libc++experimental may break user builds
until they update to -lc++fs. This should be OK, because the experimental
library provides no stability guarantees. However, I plan on looking into
ways we can force libc++experimental to automagically link libc++fs.
In order to use a single implementation and set of tests for <filesystem>, it
has been placed in a special `__fs` namespace. This namespace is inline in
C++17 onward, but not before that. As such implementation is available
in C++11 onward, but no filesystem namespace is present "directly", and
as such name conflicts shouldn't occur in C++11 or C++14.
llvm-svn: 338093
2018-07-27 11:07:09 +08:00
|
|
|
// -*- C++ -*-
|
2021-11-18 05:25:01 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
Implement <filesystem>
This patch implements the <filesystem> header and uses that
to provide <experimental/filesystem>.
Unlike other standard headers, the symbols needed for <filesystem>
have not yet been placed in libc++.so. Instead they live in the
new libc++fs.a library. Users of filesystem are required to link this
library. (Also note that libc++experimental no longer contains the
definition of <experimental/filesystem>, which now requires linking libc++fs).
The reason for keeping <filesystem> out of the dylib for now is that
it's still somewhat experimental, and the possibility of requiring an
ABI breaking change is very real. In the future the symbols will likely
be moved into the dylib, or the dylib will be made to link libc++fs automagically).
Note that moving the symbols out of libc++experimental may break user builds
until they update to -lc++fs. This should be OK, because the experimental
library provides no stability guarantees. However, I plan on looking into
ways we can force libc++experimental to automagically link libc++fs.
In order to use a single implementation and set of tests for <filesystem>, it
has been placed in a special `__fs` namespace. This namespace is inline in
C++17 onward, but not before that. As such implementation is available
in C++11 onward, but no filesystem namespace is present "directly", and
as such name conflicts shouldn't occur in C++11 or C++14.
llvm-svn: 338093
2018-07-27 11:07:09 +08:00
|
|
|
//
|
2019-01-19 18:56:40 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
Implement <filesystem>
This patch implements the <filesystem> header and uses that
to provide <experimental/filesystem>.
Unlike other standard headers, the symbols needed for <filesystem>
have not yet been placed in libc++.so. Instead they live in the
new libc++fs.a library. Users of filesystem are required to link this
library. (Also note that libc++experimental no longer contains the
definition of <experimental/filesystem>, which now requires linking libc++fs).
The reason for keeping <filesystem> out of the dylib for now is that
it's still somewhat experimental, and the possibility of requiring an
ABI breaking change is very real. In the future the symbols will likely
be moved into the dylib, or the dylib will be made to link libc++fs automagically).
Note that moving the symbols out of libc++experimental may break user builds
until they update to -lc++fs. This should be OK, because the experimental
library provides no stability guarantees. However, I plan on looking into
ways we can force libc++experimental to automagically link libc++fs.
In order to use a single implementation and set of tests for <filesystem>, it
has been placed in a special `__fs` namespace. This namespace is inline in
C++17 onward, but not before that. As such implementation is available
in C++11 onward, but no filesystem namespace is present "directly", and
as such name conflicts shouldn't occur in C++11 or C++14.
llvm-svn: 338093
2018-07-27 11:07:09 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef _LIBCPP_FILESYSTEM
|
|
|
|
#define _LIBCPP_FILESYSTEM
|
2022-03-26 00:55:36 +08:00
|
|
|
|
Implement <filesystem>
This patch implements the <filesystem> header and uses that
to provide <experimental/filesystem>.
Unlike other standard headers, the symbols needed for <filesystem>
have not yet been placed in libc++.so. Instead they live in the
new libc++fs.a library. Users of filesystem are required to link this
library. (Also note that libc++experimental no longer contains the
definition of <experimental/filesystem>, which now requires linking libc++fs).
The reason for keeping <filesystem> out of the dylib for now is that
it's still somewhat experimental, and the possibility of requiring an
ABI breaking change is very real. In the future the symbols will likely
be moved into the dylib, or the dylib will be made to link libc++fs automagically).
Note that moving the symbols out of libc++experimental may break user builds
until they update to -lc++fs. This should be OK, because the experimental
library provides no stability guarantees. However, I plan on looking into
ways we can force libc++experimental to automagically link libc++fs.
In order to use a single implementation and set of tests for <filesystem>, it
has been placed in a special `__fs` namespace. This namespace is inline in
C++17 onward, but not before that. As such implementation is available
in C++11 onward, but no filesystem namespace is present "directly", and
as such name conflicts shouldn't occur in C++11 or C++14.
llvm-svn: 338093
2018-07-27 11:07:09 +08:00
|
|
|
/*
|
|
|
|
filesystem synopsis
|
|
|
|
|
2021-10-14 23:53:43 +08:00
|
|
|
namespace std::filesystem {
|
Implement <filesystem>
This patch implements the <filesystem> header and uses that
to provide <experimental/filesystem>.
Unlike other standard headers, the symbols needed for <filesystem>
have not yet been placed in libc++.so. Instead they live in the
new libc++fs.a library. Users of filesystem are required to link this
library. (Also note that libc++experimental no longer contains the
definition of <experimental/filesystem>, which now requires linking libc++fs).
The reason for keeping <filesystem> out of the dylib for now is that
it's still somewhat experimental, and the possibility of requiring an
ABI breaking change is very real. In the future the symbols will likely
be moved into the dylib, or the dylib will be made to link libc++fs automagically).
Note that moving the symbols out of libc++experimental may break user builds
until they update to -lc++fs. This should be OK, because the experimental
library provides no stability guarantees. However, I plan on looking into
ways we can force libc++experimental to automagically link libc++fs.
In order to use a single implementation and set of tests for <filesystem>, it
has been placed in a special `__fs` namespace. This namespace is inline in
C++17 onward, but not before that. As such implementation is available
in C++11 onward, but no filesystem namespace is present "directly", and
as such name conflicts shouldn't occur in C++11 or C++14.
llvm-svn: 338093
2018-07-27 11:07:09 +08:00
|
|
|
|
|
|
|
class path;
|
|
|
|
|
|
|
|
void swap(path& lhs, path& rhs) noexcept;
|
|
|
|
size_t hash_value(const path& p) noexcept;
|
|
|
|
|
|
|
|
bool operator==(const path& lhs, const path& rhs) noexcept;
|
|
|
|
bool operator!=(const path& lhs, const path& rhs) noexcept;
|
|
|
|
bool operator< (const path& lhs, const path& rhs) noexcept;
|
|
|
|
bool operator<=(const path& lhs, const path& rhs) noexcept;
|
|
|
|
bool operator> (const path& lhs, const path& rhs) noexcept;
|
|
|
|
bool operator>=(const path& lhs, const path& rhs) noexcept;
|
|
|
|
|
|
|
|
path operator/ (const path& lhs, const path& rhs);
|
|
|
|
|
|
|
|
// fs.path.io operators are friends of path.
|
|
|
|
template <class charT, class traits>
|
|
|
|
friend basic_ostream<charT, traits>&
|
|
|
|
operator<<(basic_ostream<charT, traits>& os, const path& p);
|
|
|
|
|
|
|
|
template <class charT, class traits>
|
|
|
|
friend basic_istream<charT, traits>&
|
|
|
|
operator>>(basic_istream<charT, traits>& is, path& p);
|
|
|
|
|
|
|
|
template <class Source>
|
|
|
|
path u8path(const Source& source);
|
|
|
|
template <class InputIterator>
|
|
|
|
path u8path(InputIterator first, InputIterator last);
|
|
|
|
|
|
|
|
class filesystem_error;
|
|
|
|
class directory_entry;
|
|
|
|
|
|
|
|
class directory_iterator;
|
|
|
|
|
|
|
|
// enable directory_iterator range-based for statements
|
|
|
|
directory_iterator begin(directory_iterator iter) noexcept;
|
2021-10-14 23:53:43 +08:00
|
|
|
directory_iterator end(directory_iterator) noexcept;
|
Implement <filesystem>
This patch implements the <filesystem> header and uses that
to provide <experimental/filesystem>.
Unlike other standard headers, the symbols needed for <filesystem>
have not yet been placed in libc++.so. Instead they live in the
new libc++fs.a library. Users of filesystem are required to link this
library. (Also note that libc++experimental no longer contains the
definition of <experimental/filesystem>, which now requires linking libc++fs).
The reason for keeping <filesystem> out of the dylib for now is that
it's still somewhat experimental, and the possibility of requiring an
ABI breaking change is very real. In the future the symbols will likely
be moved into the dylib, or the dylib will be made to link libc++fs automagically).
Note that moving the symbols out of libc++experimental may break user builds
until they update to -lc++fs. This should be OK, because the experimental
library provides no stability guarantees. However, I plan on looking into
ways we can force libc++experimental to automagically link libc++fs.
In order to use a single implementation and set of tests for <filesystem>, it
has been placed in a special `__fs` namespace. This namespace is inline in
C++17 onward, but not before that. As such implementation is available
in C++11 onward, but no filesystem namespace is present "directly", and
as such name conflicts shouldn't occur in C++11 or C++14.
llvm-svn: 338093
2018-07-27 11:07:09 +08:00
|
|
|
|
|
|
|
class recursive_directory_iterator;
|
|
|
|
|
|
|
|
// enable recursive_directory_iterator range-based for statements
|
|
|
|
recursive_directory_iterator begin(recursive_directory_iterator iter) noexcept;
|
2021-10-14 23:53:43 +08:00
|
|
|
recursive_directory_iterator end(recursive_directory_iterator) noexcept;
|
Implement <filesystem>
This patch implements the <filesystem> header and uses that
to provide <experimental/filesystem>.
Unlike other standard headers, the symbols needed for <filesystem>
have not yet been placed in libc++.so. Instead they live in the
new libc++fs.a library. Users of filesystem are required to link this
library. (Also note that libc++experimental no longer contains the
definition of <experimental/filesystem>, which now requires linking libc++fs).
The reason for keeping <filesystem> out of the dylib for now is that
it's still somewhat experimental, and the possibility of requiring an
ABI breaking change is very real. In the future the symbols will likely
be moved into the dylib, or the dylib will be made to link libc++fs automagically).
Note that moving the symbols out of libc++experimental may break user builds
until they update to -lc++fs. This should be OK, because the experimental
library provides no stability guarantees. However, I plan on looking into
ways we can force libc++experimental to automagically link libc++fs.
In order to use a single implementation and set of tests for <filesystem>, it
has been placed in a special `__fs` namespace. This namespace is inline in
C++17 onward, but not before that. As such implementation is available
in C++11 onward, but no filesystem namespace is present "directly", and
as such name conflicts shouldn't occur in C++11 or C++14.
llvm-svn: 338093
2018-07-27 11:07:09 +08:00
|
|
|
|
|
|
|
class file_status;
|
|
|
|
|
|
|
|
struct space_info
|
|
|
|
{
|
|
|
|
uintmax_t capacity;
|
|
|
|
uintmax_t free;
|
|
|
|
uintmax_t available;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class file_type;
|
|
|
|
enum class perms;
|
|
|
|
enum class perm_options;
|
|
|
|
enum class copy_options;
|
|
|
|
enum class directory_options;
|
|
|
|
|
|
|
|
typedef chrono::time_point<trivial-clock> file_time_type;
|
|
|
|
|
|
|
|
// operational functions
|
|
|
|
|
|
|
|
path absolute(const path& p);
|
|
|
|
path absolute(const path& p, error_code &ec);
|
|
|
|
|
|
|
|
path canonical(const path& p);
|
|
|
|
path canonical(const path& p, error_code& ec);
|
|
|
|
|
|
|
|
void copy(const path& from, const path& to);
|
|
|
|
void copy(const path& from, const path& to, error_code& ec);
|
|
|
|
void copy(const path& from, const path& to, copy_options options);
|
|
|
|
void copy(const path& from, const path& to, copy_options options,
|
|
|
|
error_code& ec);
|
|
|
|
|
|
|
|
bool copy_file(const path& from, const path& to);
|
|
|
|
bool copy_file(const path& from, const path& to, error_code& ec);
|
|
|
|
bool copy_file(const path& from, const path& to, copy_options option);
|
|
|
|
bool copy_file(const path& from, const path& to, copy_options option,
|
|
|
|
error_code& ec);
|
|
|
|
|
|
|
|
void copy_symlink(const path& existing_symlink, const path& new_symlink);
|
|
|
|
void copy_symlink(const path& existing_symlink, const path& new_symlink,
|
|
|
|
error_code& ec) noexcept;
|
|
|
|
|
|
|
|
bool create_directories(const path& p);
|
|
|
|
bool create_directories(const path& p, error_code& ec);
|
|
|
|
|
|
|
|
bool create_directory(const path& p);
|
|
|
|
bool create_directory(const path& p, error_code& ec) noexcept;
|
|
|
|
|
|
|
|
bool create_directory(const path& p, const path& attributes);
|
|
|
|
bool create_directory(const path& p, const path& attributes,
|
|
|
|
error_code& ec) noexcept;
|
|
|
|
|
|
|
|
void create_directory_symlink(const path& to, const path& new_symlink);
|
|
|
|
void create_directory_symlink(const path& to, const path& new_symlink,
|
|
|
|
error_code& ec) noexcept;
|
|
|
|
|
|
|
|
void create_hard_link(const path& to, const path& new_hard_link);
|
|
|
|
void create_hard_link(const path& to, const path& new_hard_link,
|
|
|
|
error_code& ec) noexcept;
|
|
|
|
|
|
|
|
void create_symlink(const path& to, const path& new_symlink);
|
|
|
|
void create_symlink(const path& to, const path& new_symlink,
|
|
|
|
error_code& ec) noexcept;
|
|
|
|
|
|
|
|
path current_path();
|
|
|
|
path current_path(error_code& ec);
|
|
|
|
void current_path(const path& p);
|
|
|
|
void current_path(const path& p, error_code& ec) noexcept;
|
|
|
|
|
|
|
|
bool exists(file_status s) noexcept;
|
|
|
|
bool exists(const path& p);
|
|
|
|
bool exists(const path& p, error_code& ec) noexcept;
|
|
|
|
|
|
|
|
bool equivalent(const path& p1, const path& p2);
|
|
|
|
bool equivalent(const path& p1, const path& p2, error_code& ec) noexcept;
|
|
|
|
|
|
|
|
uintmax_t file_size(const path& p);
|
|
|
|
uintmax_t file_size(const path& p, error_code& ec) noexcept;
|
|
|
|
|
|
|
|
uintmax_t hard_link_count(const path& p);
|
|
|
|
uintmax_t hard_link_count(const path& p, error_code& ec) noexcept;
|
|
|
|
|
|
|
|
bool is_block_file(file_status s) noexcept;
|
|
|
|
bool is_block_file(const path& p);
|
|
|
|
bool is_block_file(const path& p, error_code& ec) noexcept;
|
|
|
|
|
|
|
|
bool is_character_file(file_status s) noexcept;
|
|
|
|
bool is_character_file(const path& p);
|
|
|
|
bool is_character_file(const path& p, error_code& ec) noexcept;
|
|
|
|
|
|
|
|
bool is_directory(file_status s) noexcept;
|
|
|
|
bool is_directory(const path& p);
|
|
|
|
bool is_directory(const path& p, error_code& ec) noexcept;
|
|
|
|
|
|
|
|
bool is_empty(const path& p);
|
|
|
|
bool is_empty(const path& p, error_code& ec) noexcept;
|
|
|
|
|
|
|
|
bool is_fifo(file_status s) noexcept;
|
|
|
|
bool is_fifo(const path& p);
|
|
|
|
bool is_fifo(const path& p, error_code& ec) noexcept;
|
|
|
|
|
|
|
|
bool is_other(file_status s) noexcept;
|
|
|
|
bool is_other(const path& p);
|
|
|
|
bool is_other(const path& p, error_code& ec) noexcept;
|
|
|
|
|
|
|
|
bool is_regular_file(file_status s) noexcept;
|
|
|
|
bool is_regular_file(const path& p);
|
|
|
|
bool is_regular_file(const path& p, error_code& ec) noexcept;
|
|
|
|
|
|
|
|
bool is_socket(file_status s) noexcept;
|
|
|
|
bool is_socket(const path& p);
|
|
|
|
bool is_socket(const path& p, error_code& ec) noexcept;
|
|
|
|
|
|
|
|
bool is_symlink(file_status s) noexcept;
|
|
|
|
bool is_symlink(const path& p);
|
|
|
|
bool is_symlink(const path& p, error_code& ec) noexcept;
|
|
|
|
|
|
|
|
file_time_type last_write_time(const path& p);
|
|
|
|
file_time_type last_write_time(const path& p, error_code& ec) noexcept;
|
|
|
|
void last_write_time(const path& p, file_time_type new_time);
|
|
|
|
void last_write_time(const path& p, file_time_type new_time,
|
|
|
|
error_code& ec) noexcept;
|
|
|
|
|
|
|
|
void permissions(const path& p, perms prms,
|
|
|
|
perm_options opts=perm_options::replace);
|
|
|
|
void permissions(const path& p, perms prms, error_code& ec) noexcept;
|
|
|
|
void permissions(const path& p, perms prms, perm_options opts,
|
|
|
|
error_code& ec);
|
|
|
|
|
|
|
|
path proximate(const path& p, error_code& ec);
|
|
|
|
path proximate(const path& p, const path& base = current_path());
|
|
|
|
path proximate(const path& p, const path& base, error_code &ec);
|
|
|
|
|
|
|
|
path read_symlink(const path& p);
|
|
|
|
path read_symlink(const path& p, error_code& ec);
|
|
|
|
|
|
|
|
path relative(const path& p, error_code& ec);
|
|
|
|
path relative(const path& p, const path& base=current_path());
|
|
|
|
path relative(const path& p, const path& base, error_code& ec);
|
|
|
|
|
|
|
|
bool remove(const path& p);
|
|
|
|
bool remove(const path& p, error_code& ec) noexcept;
|
|
|
|
|
|
|
|
uintmax_t remove_all(const path& p);
|
|
|
|
uintmax_t remove_all(const path& p, error_code& ec);
|
|
|
|
|
|
|
|
void rename(const path& from, const path& to);
|
|
|
|
void rename(const path& from, const path& to, error_code& ec) noexcept;
|
|
|
|
|
|
|
|
void resize_file(const path& p, uintmax_t size);
|
|
|
|
void resize_file(const path& p, uintmax_t size, error_code& ec) noexcept;
|
|
|
|
|
|
|
|
space_info space(const path& p);
|
|
|
|
space_info space(const path& p, error_code& ec) noexcept;
|
|
|
|
|
|
|
|
file_status status(const path& p);
|
|
|
|
file_status status(const path& p, error_code& ec) noexcept;
|
|
|
|
|
|
|
|
bool status_known(file_status s) noexcept;
|
|
|
|
|
|
|
|
file_status symlink_status(const path& p);
|
|
|
|
file_status symlink_status(const path& p, error_code& ec) noexcept;
|
|
|
|
|
|
|
|
path temp_directory_path();
|
|
|
|
path temp_directory_path(error_code& ec);
|
|
|
|
|
|
|
|
path weakly_canonical(path const& p);
|
|
|
|
path weakly_canonical(path const& p, error_code& ec);
|
|
|
|
|
2021-10-14 23:53:43 +08:00
|
|
|
} // namespace std::filesystem
|
Implement <filesystem>
This patch implements the <filesystem> header and uses that
to provide <experimental/filesystem>.
Unlike other standard headers, the symbols needed for <filesystem>
have not yet been placed in libc++.so. Instead they live in the
new libc++fs.a library. Users of filesystem are required to link this
library. (Also note that libc++experimental no longer contains the
definition of <experimental/filesystem>, which now requires linking libc++fs).
The reason for keeping <filesystem> out of the dylib for now is that
it's still somewhat experimental, and the possibility of requiring an
ABI breaking change is very real. In the future the symbols will likely
be moved into the dylib, or the dylib will be made to link libc++fs automagically).
Note that moving the symbols out of libc++experimental may break user builds
until they update to -lc++fs. This should be OK, because the experimental
library provides no stability guarantees. However, I plan on looking into
ways we can force libc++experimental to automagically link libc++fs.
In order to use a single implementation and set of tests for <filesystem>, it
has been placed in a special `__fs` namespace. This namespace is inline in
C++17 onward, but not before that. As such implementation is available
in C++11 onward, but no filesystem namespace is present "directly", and
as such name conflicts shouldn't occur in C++11 or C++14.
llvm-svn: 338093
2018-07-27 11:07:09 +08:00
|
|
|
|
2021-10-14 23:53:43 +08:00
|
|
|
template <>
|
|
|
|
inline constexpr bool std::ranges::enable_borrowed_range<std::filesystem::directory_iterator> = true;
|
|
|
|
template <>
|
|
|
|
inline constexpr bool std::ranges::enable_borrowed_range<std::filesystem::recursive_directory_iterator> = true;
|
|
|
|
|
|
|
|
template <>
|
|
|
|
inline constexpr bool std::ranges::enable_view<std::filesystem::directory_iterator> = true;
|
|
|
|
template <>
|
|
|
|
inline constexpr bool std::ranges::enable_view<std::filesystem::recursive_directory_iterator> = true;
|
Implement <filesystem>
This patch implements the <filesystem> header and uses that
to provide <experimental/filesystem>.
Unlike other standard headers, the symbols needed for <filesystem>
have not yet been placed in libc++.so. Instead they live in the
new libc++fs.a library. Users of filesystem are required to link this
library. (Also note that libc++experimental no longer contains the
definition of <experimental/filesystem>, which now requires linking libc++fs).
The reason for keeping <filesystem> out of the dylib for now is that
it's still somewhat experimental, and the possibility of requiring an
ABI breaking change is very real. In the future the symbols will likely
be moved into the dylib, or the dylib will be made to link libc++fs automagically).
Note that moving the symbols out of libc++experimental may break user builds
until they update to -lc++fs. This should be OK, because the experimental
library provides no stability guarantees. However, I plan on looking into
ways we can force libc++experimental to automagically link libc++fs.
In order to use a single implementation and set of tests for <filesystem>, it
has been placed in a special `__fs` namespace. This namespace is inline in
C++17 onward, but not before that. As such implementation is available
in C++11 onward, but no filesystem namespace is present "directly", and
as such name conflicts shouldn't occur in C++11 or C++14.
llvm-svn: 338093
2018-07-27 11:07:09 +08:00
|
|
|
|
|
|
|
*/
|
|
|
|
|
2022-03-26 00:55:36 +08:00
|
|
|
#include <__assert> // all public C++ headers provide the assertion handler
|
2021-12-23 18:55:38 +08:00
|
|
|
#include <__config>
|
2021-12-23 19:21:00 +08:00
|
|
|
#include <__filesystem/copy_options.h>
|
|
|
|
#include <__filesystem/directory_entry.h>
|
|
|
|
#include <__filesystem/directory_iterator.h>
|
|
|
|
#include <__filesystem/directory_options.h>
|
|
|
|
#include <__filesystem/file_status.h>
|
|
|
|
#include <__filesystem/file_time_type.h>
|
|
|
|
#include <__filesystem/file_type.h>
|
|
|
|
#include <__filesystem/filesystem_error.h>
|
|
|
|
#include <__filesystem/operations.h>
|
|
|
|
#include <__filesystem/path.h>
|
2022-01-07 22:45:05 +08:00
|
|
|
#include <__filesystem/path_iterator.h>
|
2021-12-23 19:21:00 +08:00
|
|
|
#include <__filesystem/perm_options.h>
|
|
|
|
#include <__filesystem/perms.h>
|
|
|
|
#include <__filesystem/recursive_directory_iterator.h>
|
|
|
|
#include <__filesystem/space_info.h>
|
|
|
|
#include <__filesystem/u8path.h>
|
2021-03-25 06:19:12 +08:00
|
|
|
#include <compare>
|
2018-09-13 03:41:40 +08:00
|
|
|
#include <version>
|
Implement <filesystem>
This patch implements the <filesystem> header and uses that
to provide <experimental/filesystem>.
Unlike other standard headers, the symbols needed for <filesystem>
have not yet been placed in libc++.so. Instead they live in the
new libc++fs.a library. Users of filesystem are required to link this
library. (Also note that libc++experimental no longer contains the
definition of <experimental/filesystem>, which now requires linking libc++fs).
The reason for keeping <filesystem> out of the dylib for now is that
it's still somewhat experimental, and the possibility of requiring an
ABI breaking change is very real. In the future the symbols will likely
be moved into the dylib, or the dylib will be made to link libc++fs automagically).
Note that moving the symbols out of libc++experimental may break user builds
until they update to -lc++fs. This should be OK, because the experimental
library provides no stability guarantees. However, I plan on looking into
ways we can force libc++experimental to automagically link libc++fs.
In order to use a single implementation and set of tests for <filesystem>, it
has been placed in a special `__fs` namespace. This namespace is inline in
C++17 onward, but not before that. As such implementation is available
in C++11 onward, but no filesystem namespace is present "directly", and
as such name conflicts shouldn't occur in C++11 or C++14.
llvm-svn: 338093
2018-07-27 11:07:09 +08:00
|
|
|
|
2021-01-19 01:18:18 +08:00
|
|
|
#if defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY)
|
2022-05-19 01:17:14 +08:00
|
|
|
# error "The <filesystem> library is not supported since libc++ has been configured without support for a filesystem."
|
2021-01-19 01:18:18 +08:00
|
|
|
#endif
|
|
|
|
|
Implement <filesystem>
This patch implements the <filesystem> header and uses that
to provide <experimental/filesystem>.
Unlike other standard headers, the symbols needed for <filesystem>
have not yet been placed in libc++.so. Instead they live in the
new libc++fs.a library. Users of filesystem are required to link this
library. (Also note that libc++experimental no longer contains the
definition of <experimental/filesystem>, which now requires linking libc++fs).
The reason for keeping <filesystem> out of the dylib for now is that
it's still somewhat experimental, and the possibility of requiring an
ABI breaking change is very real. In the future the symbols will likely
be moved into the dylib, or the dylib will be made to link libc++fs automagically).
Note that moving the symbols out of libc++experimental may break user builds
until they update to -lc++fs. This should be OK, because the experimental
library provides no stability guarantees. However, I plan on looking into
ways we can force libc++experimental to automagically link libc++fs.
In order to use a single implementation and set of tests for <filesystem>, it
has been placed in a special `__fs` namespace. This namespace is inline in
C++17 onward, but not before that. As such implementation is available
in C++11 onward, but no filesystem namespace is present "directly", and
as such name conflicts shouldn't occur in C++11 or C++14.
llvm-svn: 338093
2018-07-27 11:07:09 +08:00
|
|
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
2022-02-02 09:16:40 +08:00
|
|
|
# pragma GCC system_header
|
Implement <filesystem>
This patch implements the <filesystem> header and uses that
to provide <experimental/filesystem>.
Unlike other standard headers, the symbols needed for <filesystem>
have not yet been placed in libc++.so. Instead they live in the
new libc++fs.a library. Users of filesystem are required to link this
library. (Also note that libc++experimental no longer contains the
definition of <experimental/filesystem>, which now requires linking libc++fs).
The reason for keeping <filesystem> out of the dylib for now is that
it's still somewhat experimental, and the possibility of requiring an
ABI breaking change is very real. In the future the symbols will likely
be moved into the dylib, or the dylib will be made to link libc++fs automagically).
Note that moving the symbols out of libc++experimental may break user builds
until they update to -lc++fs. This should be OK, because the experimental
library provides no stability guarantees. However, I plan on looking into
ways we can force libc++experimental to automagically link libc++fs.
In order to use a single implementation and set of tests for <filesystem>, it
has been placed in a special `__fs` namespace. This namespace is inline in
C++17 onward, but not before that. As such implementation is available
in C++11 onward, but no filesystem namespace is present "directly", and
as such name conflicts shouldn't occur in C++11 or C++14.
llvm-svn: 338093
2018-07-27 11:07:09 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // _LIBCPP_FILESYSTEM
|