From a0866c5fb5020d15c69deda94d32a7f982b88dc9 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Fri, 27 Jul 2018 03:07:09 +0000 Subject: [PATCH] Implement This patch implements the header and uses that to provide . Unlike other standard headers, the symbols needed for 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 , which now requires linking libc++fs). The reason for keeping 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 , 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. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@338093 91177308-0d34-0410-b5e6-96231b3b80d8 --- CMakeLists.txt | 4 + docs/BuildingLibcxx.rst | 10 +- docs/UsingLibcxx.rst | 21 + include/__config | 37 +- include/experimental/__config | 2 - include/experimental/filesystem | 2464 +-------------- include/filesystem | 2682 +++++++++++++++++ include/fstream | 61 + include/module.modulemap | 4 + lib/CMakeLists.txt | 50 +- .../filesystem/directory_iterator.cpp | 287 +- .../filesystem/filesystem_common.h | 25 +- .../filesystem/int128_builtins.cpp | 2 +- .../filesystem/operations.cpp | 683 ++--- test/libcxx/double_include.sh.cpp | 1 + .../experimental/filesystem/version.pass.cpp | 2 - .../last_write_time.sh.cpp | 4 +- .../class.path/path.itr/iterator_db.pass.cpp | 6 +- ...erse_iterator_produces_diagnostic.fail.cpp | 6 +- .../class.path/path.req/is_pathable.pass.cpp | 6 +- .../filesystems}/convert_file_time.sh.cpp | 8 +- .../filesystems}/lit.local.cfg | 0 .../input.output/filesystems/version.pass.cpp | 20 + .../filebuf.members/open_path.pass.cpp | 56 + .../fstreams/fstream.cons/path.pass.cpp | 49 + .../fstream.members/open_path.pass.cpp | 52 + .../fstreams/ifstream.cons/path.pass.cpp | 53 + .../ifstream.members/open_path.pass.cpp | 48 + .../fstreams/ofstream.cons/path.pass.cpp | 69 + .../ofstream.members/open_path.pass.cpp | 62 + .../Inputs/static_test_env/bad_symlink | 0 .../Inputs/static_test_env/dir1/dir2/afile3 | 0 .../static_test_env/dir1/dir2/dir3/file5 | 0 .../Inputs/static_test_env/dir1/dir2/file4 | 0 .../static_test_env/dir1/dir2/symlink_to_dir3 | 0 .../Inputs/static_test_env/dir1/file1 | 0 .../Inputs/static_test_env/dir1/file2 | 0 .../Inputs/static_test_env/empty_file | 0 .../Inputs/static_test_env/non_empty_file | 0 .../Inputs/static_test_env/symlink_to_dir | 0 .../static_test_env/symlink_to_empty_file | 0 .../directory_entry.cons/copy.pass.cpp | 2 +- .../directory_entry.cons/copy_assign.pass.cpp | 2 +- .../directory_entry.cons/default.pass.cpp | 2 +- .../default_const.pass.cpp | 2 +- .../directory_entry.cons/move.pass.cpp | 2 +- .../directory_entry.cons/move_assign.pass.cpp | 2 +- .../directory_entry.cons/path.pass.cpp | 2 +- .../directory_entry.mods/assign.pass.cpp | 2 +- .../directory_entry.mods/refresh.pass.cpp | 2 +- .../replace_filename.pass.cpp | 2 +- .../directory_entry.obs/comparisons.pass.cpp | 2 +- .../directory_entry.obs/file_size.pass.cpp | 2 +- .../file_type_obs.pass.cpp | 2 +- .../hard_link_count.pass.cpp | 2 +- .../last_write_time.pass.cpp | 2 +- .../directory_entry.obs/path.pass.cpp | 2 +- .../directory_entry.obs/status.pass.cpp | 2 +- .../symlink_status.pass.cpp | 2 +- .../directory_iterator.members/copy.pass.cpp | 2 +- .../copy_assign.pass.cpp | 2 +- .../directory_iterator.members/ctor.pass.cpp | 2 +- .../default_ctor.pass.cpp | 2 +- .../increment.pass.cpp | 2 +- .../directory_iterator.members/move.pass.cpp | 2 +- .../move_assign.pass.cpp | 2 +- .../begin_end.pass.cpp | 2 +- .../class.directory_iterator/types.pass.cpp | 2 +- .../file_status.cons.pass.cpp | 2 +- .../file_status.mods.pass.cpp | 2 +- .../file_status.obs.pass.cpp | 2 +- .../filesystem_error.members.pass.cpp | 2 +- .../class.path/path.itr/iterator.pass.cpp | 2 +- .../path.member/path.append.pass.cpp | 2 +- .../path.assign/braced_init.pass.cpp | 2 +- .../path.member/path.assign/copy.pass.cpp | 2 +- .../path.member/path.assign/move.pass.cpp | 2 +- .../path.member/path.assign/source.pass.cpp | 2 +- .../path.member/path.compare.pass.cpp | 2 +- .../path.member/path.concat.pass.cpp | 2 +- .../path.member/path.construct/copy.pass.cpp | 2 +- .../path.construct/default.pass.cpp | 2 +- .../path.member/path.construct/move.pass.cpp | 2 +- .../path.construct/source.pass.cpp | 2 +- .../path.member/path.decompose/empty.fail.cpp | 2 +- .../path.decompose/path.decompose.pass.cpp | 2 +- .../path.gen/lexically_normal.pass.cpp | 2 +- .../lexically_relative_and_proximate.pass.cpp | 2 +- .../generic_string_alloc.pass.cpp | 2 +- .../path.generic.obs/named_overloads.pass.cpp | 2 +- .../path.member/path.modifiers/clear.pass.cpp | 2 +- .../path.modifiers/make_preferred.pass.cpp | 2 +- .../path.modifiers/remove_filename.pass.cpp | 2 +- .../path.modifiers/replace_extension.pass.cpp | 2 +- .../path.modifiers/replace_filename.pass.cpp | 2 +- .../path.member/path.modifiers/swap.pass.cpp | 2 +- .../path.native.obs/c_str.pass.cpp | 2 +- .../path.native.obs/named_overloads.pass.cpp | 2 +- .../path.native.obs/native.pass.cpp | 2 +- .../path.native.obs/operator_string.pass.cpp | 2 +- .../path.native.obs/string_alloc.pass.cpp | 2 +- .../tested_in_path_decompose.pass.cpp | 2 +- .../path.nonmember/append_op.pass.cpp | 2 +- .../comparison_ops_tested_elsewhere.pass.cpp | 0 .../hash_value_tested_elswhere.pass.cpp | 0 .../path.nonmember/path.factory.pass.cpp | 2 +- .../path.nonmember/path.io.pass.cpp | 2 +- .../path.io.unicode_bug.pass.cpp | 2 +- .../class.path/path.nonmember/swap.pass.cpp | 2 +- .../filesystems}/class.path/synop.pass.cpp | 2 +- .../rec.dir.itr.members/copy.pass.cpp | 2 +- .../rec.dir.itr.members/copy_assign.pass.cpp | 2 +- .../rec.dir.itr.members/ctor.pass.cpp | 2 +- .../rec.dir.itr.members/depth.pass.cpp | 2 +- .../disable_recursion_pending.pass.cpp | 2 +- .../rec.dir.itr.members/increment.pass.cpp | 2 +- .../rec.dir.itr.members/move.pass.cpp | 2 +- .../rec.dir.itr.members/move_assign.pass.cpp | 2 +- .../rec.dir.itr.members/pop.pass.cpp | 2 +- .../recursion_pending.pass.cpp | 2 +- .../rec.dir.itr.nonmembers/begin_end.pass.cpp | 2 +- .../fs.enum/check_bitmask_types.hpp | 0 .../fs.enum/enum.copy_options.pass.cpp | 2 +- .../fs.enum/enum.directory_options.pass.cpp | 2 +- .../fs.enum/enum.file_type.pass.cpp | 2 +- .../fs.enum/enum.path.format.pass.cpp | 2 +- .../fs.enum/enum.perm_options.pass.cpp | 2 +- .../filesystems}/fs.enum/enum.perms.pass.cpp | 2 +- .../fs.error.report/tested_elsewhere.pass.cpp | 0 .../file_time_type.pass.cpp | 2 +- .../fs.op.absolute/absolute.pass.cpp | 2 +- .../fs.op.canonical/canonical.pass.cpp | 2 +- .../fs.op.funcs/fs.op.copy/copy.pass.cpp | 2 +- .../fs.op.copy_file/copy_file.pass.cpp | 2 +- .../fs.op.copy_file/copy_file_large.pass.cpp | 2 +- .../fs.op.copy_symlink/copy_symlink.pass.cpp | 2 +- .../create_directories.pass.cpp | 2 +- .../create_directory.pass.cpp | 2 +- .../create_directory_with_attributes.pass.cpp | 2 +- .../create_directory_symlink.pass.cpp | 2 +- .../create_hard_link.pass.cpp | 2 +- .../create_symlink.pass.cpp | 2 +- .../fs.op.current_path/current_path.pass.cpp | 2 +- .../fs.op.equivalent/equivalent.pass.cpp | 2 +- .../fs.op.funcs/fs.op.exists/exists.pass.cpp | 2 +- .../fs.op.file_size/file_size.pass.cpp | 2 +- .../fs.op.hard_lk_ct/hard_link_count.pass.cpp | 2 +- .../is_block_file.pass.cpp | 2 +- .../is_character_file.pass.cpp | 2 +- .../fs.op.is_directory/is_directory.pass.cpp | 2 +- .../fs.op.is_empty/is_empty.pass.cpp | 2 +- .../fs.op.is_fifo/is_fifo.pass.cpp | 2 +- .../fs.op.is_other/is_other.pass.cpp | 2 +- .../is_regular_file.pass.cpp | 2 +- .../fs.op.is_socket/is_socket.pass.cpp | 2 +- .../fs.op.is_symlink/is_symlink.pass.cpp | 2 +- .../last_write_time.pass.cpp | 2 +- .../fs.op.permissions/permissions.pass.cpp | 2 +- .../fs.op.proximate/proximate.pass.cpp | 2 +- .../fs.op.read_symlink/read_symlink.pass.cpp | 2 +- .../fs.op.relative/relative.pass.cpp | 2 +- .../fs.op.funcs/fs.op.remove/remove.pass.cpp | 2 +- .../fs.op.remove_all/remove_all.pass.cpp | 2 +- .../fs.op.funcs/fs.op.rename/rename.pass.cpp | 2 +- .../fs.op.resize_file/resize_file.pass.cpp | 2 +- .../fs.op.funcs/fs.op.space/space.pass.cpp | 2 +- .../fs.op.funcs/fs.op.status/status.pass.cpp | 2 +- .../fs.op.status_known/status_known.pass.cpp | 2 +- .../symlink_status.pass.cpp | 2 +- .../temp_directory_path.pass.cpp | 2 +- .../weakly_canonical.pass.cpp | 2 +- .../fs.req.macros/feature_macro.pass.cpp | 29 + .../fs.req.namespace/namespace.fail.cpp | 29 + .../fs.req.namespace/namespace.pass.cpp | 26 + .../filesystems}/lit.local.cfg | 0 test/support/filesystem_include.hpp | 15 +- utils/libcxx/test/config.py | 10 +- www/cxx1z_status.html | 4 +- 178 files changed, 3978 insertions(+), 3161 deletions(-) create mode 100644 include/filesystem rename src/{experimental => }/filesystem/directory_iterator.cpp (55%) rename src/{experimental => }/filesystem/filesystem_common.h (96%) rename src/{experimental => }/filesystem/int128_builtins.cpp (97%) rename src/{experimental => }/filesystem/operations.cpp (76%) rename test/libcxx/{experimental/filesystem => input.output/filesystems}/class.directory_entry/directory_entry.mods/last_write_time.sh.cpp (96%) rename test/libcxx/{experimental/filesystem => input.output/filesystems}/class.path/path.itr/iterator_db.pass.cpp (93%) rename test/libcxx/{experimental/filesystem => input.output/filesystems}/class.path/path.itr/reverse_iterator_produces_diagnostic.fail.cpp (87%) rename test/libcxx/{experimental/filesystem => input.output/filesystems}/class.path/path.req/is_pathable.pass.cpp (96%) rename test/libcxx/{experimental/filesystem => input.output/filesystems}/convert_file_time.sh.cpp (98%) rename test/libcxx/{experimental/filesystem => input.output/filesystems}/lit.local.cfg (100%) create mode 100644 test/libcxx/input.output/filesystems/version.pass.cpp create mode 100644 test/std/input.output/file.streams/fstreams/filebuf.members/open_path.pass.cpp create mode 100644 test/std/input.output/file.streams/fstreams/fstream.cons/path.pass.cpp create mode 100644 test/std/input.output/file.streams/fstreams/fstream.members/open_path.pass.cpp create mode 100644 test/std/input.output/file.streams/fstreams/ifstream.cons/path.pass.cpp create mode 100644 test/std/input.output/file.streams/fstreams/ifstream.members/open_path.pass.cpp create mode 100644 test/std/input.output/file.streams/fstreams/ofstream.cons/path.pass.cpp create mode 100644 test/std/input.output/file.streams/fstreams/ofstream.members/open_path.pass.cpp rename test/std/{experimental/filesystem => input.output/filesystems}/Inputs/static_test_env/bad_symlink (100%) rename test/std/{experimental/filesystem => input.output/filesystems}/Inputs/static_test_env/dir1/dir2/afile3 (100%) rename test/std/{experimental/filesystem => input.output/filesystems}/Inputs/static_test_env/dir1/dir2/dir3/file5 (100%) rename test/std/{experimental/filesystem => input.output/filesystems}/Inputs/static_test_env/dir1/dir2/file4 (100%) rename test/std/{experimental/filesystem => input.output/filesystems}/Inputs/static_test_env/dir1/dir2/symlink_to_dir3 (100%) rename test/std/{experimental/filesystem => input.output/filesystems}/Inputs/static_test_env/dir1/file1 (100%) rename test/std/{experimental/filesystem => input.output/filesystems}/Inputs/static_test_env/dir1/file2 (100%) rename test/std/{experimental/filesystem => input.output/filesystems}/Inputs/static_test_env/empty_file (100%) rename test/std/{experimental/filesystem => input.output/filesystems}/Inputs/static_test_env/non_empty_file (100%) rename test/std/{experimental/filesystem => input.output/filesystems}/Inputs/static_test_env/symlink_to_dir (100%) rename test/std/{experimental/filesystem => input.output/filesystems}/Inputs/static_test_env/symlink_to_empty_file (100%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_entry/directory_entry.cons/copy.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_entry/directory_entry.cons/copy_assign.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_entry/directory_entry.cons/default.pass.cpp (96%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_entry/directory_entry.cons/default_const.pass.cpp (96%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_entry/directory_entry.cons/move.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_entry/directory_entry.cons/move_assign.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_entry/directory_entry.cons/path.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_entry/directory_entry.mods/assign.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_entry/directory_entry.mods/refresh.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_entry/directory_entry.mods/replace_filename.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_entry/directory_entry.obs/comparisons.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_entry/directory_entry.obs/file_size.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_entry/directory_entry.obs/file_type_obs.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_entry/directory_entry.obs/hard_link_count.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_entry/directory_entry.obs/last_write_time.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_entry/directory_entry.obs/path.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_entry/directory_entry.obs/status.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_entry/directory_entry.obs/symlink_status.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_iterator/directory_iterator.members/copy.pass.cpp (97%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_iterator/directory_iterator.members/ctor.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_iterator/directory_iterator.members/default_ctor.pass.cpp (96%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_iterator/directory_iterator.members/increment.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_iterator/directory_iterator.members/move.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.directory_iterator/types.pass.cpp (97%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.file_status/file_status.cons.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.file_status/file_status.mods.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.file_status/file_status.obs.pass.cpp (97%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.filesystem_error/filesystem_error.members.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.itr/iterator.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.append.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.assign/braced_init.pass.cpp (95%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.assign/copy.pass.cpp (96%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.assign/move.pass.cpp (97%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.assign/source.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.compare.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.concat.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.construct/copy.pass.cpp (96%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.construct/default.pass.cpp (95%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.construct/move.pass.cpp (97%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.construct/source.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.decompose/empty.fail.cpp (96%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.decompose/path.decompose.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.gen/lexically_normal.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.generic.obs/named_overloads.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.modifiers/clear.pass.cpp (96%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.modifiers/make_preferred.pass.cpp (97%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.modifiers/remove_filename.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.modifiers/replace_extension.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.modifiers/replace_filename.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.modifiers/swap.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.native.obs/c_str.pass.cpp (97%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.native.obs/named_overloads.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.native.obs/native.pass.cpp (96%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.native.obs/operator_string.pass.cpp (97%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.native.obs/string_alloc.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.member/path.query/tested_in_path_decompose.pass.cpp (96%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.nonmember/append_op.pass.cpp (96%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.nonmember/comparison_ops_tested_elsewhere.pass.cpp (100%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.nonmember/hash_value_tested_elswhere.pass.cpp (100%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.nonmember/path.factory.pass.cpp (97%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.nonmember/path.io.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.nonmember/path.io.unicode_bug.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/path.nonmember/swap.pass.cpp (97%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.path/synop.pass.cpp (97%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp (97%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.enum/check_bitmask_types.hpp (100%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.enum/enum.copy_options.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.enum/enum.directory_options.pass.cpp (97%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.enum/enum.file_type.pass.cpp (97%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.enum/enum.path.format.pass.cpp (97%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.enum/enum.perm_options.pass.cpp (97%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.enum/enum.perms.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.error.report/tested_elsewhere.pass.cpp (100%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.filesystem.synopsis/file_time_type.pass.cpp (97%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.absolute/absolute.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.canonical/canonical.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.copy/copy.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.copy_file/copy_file_large.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.current_path/current_path.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.exists/exists.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.file_size/file_size.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.is_other/is_other.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.permissions/permissions.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.proximate/proximate.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.relative/relative.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.remove/remove.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.rename/rename.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.space/space.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.status/status.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.status_known/status_known.pass.cpp (98%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp (99%) rename test/std/{experimental/filesystem => input.output/filesystems}/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp (98%) create mode 100644 test/std/input.output/filesystems/fs.req.macros/feature_macro.pass.cpp create mode 100644 test/std/input.output/filesystems/fs.req.namespace/namespace.fail.cpp create mode 100644 test/std/input.output/filesystems/fs.req.namespace/namespace.pass.cpp rename test/std/{experimental/filesystem => input.output/filesystems}/lit.local.cfg (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a692ac62..cd4786ec6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,6 +107,10 @@ option(LIBCXX_INSTALL_SUPPORT_HEADERS "Install libc++ support headers." ON) cmake_dependent_option(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY "Install libc++experimental.a" ON "LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY;LIBCXX_INSTALL_LIBRARY" OFF) +cmake_dependent_option(LIBCXX_INSTALL_FILESYSTEM_LIBRARY + "Install libc++fs.a" ON + "LIBCXX_ENABLE_FILESYSTEM_LIBRARY;LIBCXX_INSTALL_LIBRARY" OFF) + if (FUCHSIA) set(DEFAULT_ABI_VERSION 2) else() diff --git a/docs/BuildingLibcxx.rst b/docs/BuildingLibcxx.rst index 3dae2f41c..d0b03c675 100644 --- a/docs/BuildingLibcxx.rst +++ b/docs/BuildingLibcxx.rst @@ -242,11 +242,15 @@ libc++experimental Specific Options .. option:: LIBCXX_ENABLE_FILESYSTEM:BOOL - **Default**: ``LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY`` + **Default**: ``ON`` - Build filesystem as part of libc++experimental.a. This allows filesystem - to be disabled without turning off the entire experimental library. + Build filesystem as a standalone library libc++fs.a. +.. option:: LIBCXX_INSTALL_FILESYSTEM_LIBRARY:BOOL + + **Default**: ``LIBCXX_ENABLE_FILESYSTEM AND LIBCXX_INSTALL_LIBRARY`` + + Install libc++fs.a alongside libc++. .. _ABI Library Specific Options: diff --git a/docs/UsingLibcxx.rst b/docs/UsingLibcxx.rst index f54234d6a..e10a27c59 100644 --- a/docs/UsingLibcxx.rst +++ b/docs/UsingLibcxx.rst @@ -49,6 +49,24 @@ An example of using ``LD_LIBRARY_PATH``: $ export LD_LIBRARY_PATH=/lib $ ./a.out # Searches for libc++ along LD_LIBRARY_PATH + +Using ```` and libc++fs +==================================== + +Libc++ provides the implementation of the filesystem library in a separate +library. Users of ```` and ```` are +required to link ``-lc++fs``. + +.. note:: + Prior to libc++ 7.0, users of ```` were required + to link libc++experimental. + +.. warning:: + The Filesystem library is still experimental in nature. As such normal + guarantees about ABI stability and backwards compatibility do not yet apply + to it. In the future, this restriction will be removed. + + Using libc++experimental and ```` ===================================================== @@ -65,6 +83,9 @@ installed. For information on building libc++experimental from source see :ref:`Building Libc++ ` and :ref:`libc++experimental CMake Options `. +Note that as of libc++ 7.0 using the ```` requires linking +libc++fs instead of libc++experimental. + Also see the `Experimental Library Implementation Status `__ page. diff --git a/include/__config b/include/__config index f659ba943..4b17fb5e7 100644 --- a/include/__config +++ b/include/__config @@ -43,6 +43,18 @@ # endif #endif +#ifndef _LIBCPP_STD_VER +# if __cplusplus <= 201103L +# define _LIBCPP_STD_VER 11 +# elif __cplusplus <= 201402L +# define _LIBCPP_STD_VER 14 +# elif __cplusplus <= 201703L +# define _LIBCPP_STD_VER 17 +# else +# define _LIBCPP_STD_VER 18 // current year, or date of c++2a ratification +# endif +#endif // _LIBCPP_STD_VER + #if defined(__ELF__) # define _LIBCPP_OBJECT_FORMAT_ELF 1 #elif defined(__MACH__) @@ -462,6 +474,19 @@ namespace std { } } +#if _LIBCPP_STD_VER >= 17 +#define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \ + _LIBCPP_BEGIN_NAMESPACE_STD inline namespace __fs { namespace filesystem { +#else +#define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \ + _LIBCPP_BEGIN_NAMESPACE_STD namespace __fs { namespace filesystem { +#endif + +#define _LIBCPP_END_NAMESPACE_FILESYSTEM \ + _LIBCPP_END_NAMESPACE_STD } } + +#define _VSTD_FS _VSTD::__fs::filesystem + #if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer) #define _LIBCPP_HAS_NO_ASAN #endif @@ -959,18 +984,6 @@ template struct __static_assert_check {}; #define _LIBCPP_WCTYPE_IS_MASK #endif -#ifndef _LIBCPP_STD_VER -# if __cplusplus <= 201103L -# define _LIBCPP_STD_VER 11 -# elif __cplusplus <= 201402L -# define _LIBCPP_STD_VER 14 -# elif __cplusplus <= 201703L -# define _LIBCPP_STD_VER 17 -# else -# define _LIBCPP_STD_VER 18 // current year, or date of c++2a ratification -# endif -#endif // _LIBCPP_STD_VER - #if _LIBCPP_STD_VER > 11 # define _LIBCPP_DEPRECATED [[deprecated]] #else diff --git a/include/experimental/__config b/include/experimental/__config index 97c25438a..55ae31b8a 100644 --- a/include/experimental/__config +++ b/include/experimental/__config @@ -52,8 +52,6 @@ #define _VSTD_CORO _VSTD_EXPERIMENTAL::coroutines_v1 -#define _VSTD_FS ::std::experimental::filesystem::v1 - #define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_SIMD \ _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace parallelism_v2 { diff --git a/include/experimental/filesystem b/include/experimental/filesystem index dbc03595d..28d8dcf4f 100644 --- a/include/experimental/filesystem +++ b/include/experimental/filesystem @@ -231,21 +231,7 @@ */ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // for quoted -#include - -#include <__debug> +#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -260,2453 +246,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FILESYSTEM -struct _FilesystemClock { -#if !defined(_LIBCPP_HAS_NO_INT128) - typedef __int128_t rep; - typedef nano period; -#else - typedef long long rep; - typedef nano period; -#endif - - typedef chrono::duration duration; - typedef chrono::time_point<_FilesystemClock> time_point; - - static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = false; - - _LIBCPP_FUNC_VIS static time_point now() noexcept; - - _LIBCPP_INLINE_VISIBILITY - static time_t to_time_t(const time_point& __t) noexcept { - typedef chrono::duration __secs; - return time_t( - chrono::duration_cast<__secs>(__t.time_since_epoch()).count()); - } - - _LIBCPP_INLINE_VISIBILITY - static time_point from_time_t(time_t __t) noexcept { - typedef chrono::duration __secs; - return time_point(__secs(__t)); - } -}; - -typedef chrono::time_point<_FilesystemClock> file_time_type; - -struct _LIBCPP_TYPE_VIS space_info -{ - uintmax_t capacity; - uintmax_t free; - uintmax_t available; -}; - -enum class _LIBCPP_ENUM_VIS file_type : signed char -{ - none = 0, - not_found = -1, - regular = 1, - directory = 2, - symlink = 3, - block = 4, - character = 5, - fifo = 6, - socket = 7, - unknown = 8 -}; - -enum class _LIBCPP_ENUM_VIS perms : unsigned -{ - none = 0, - - owner_read = 0400, - owner_write = 0200, - owner_exec = 0100, - owner_all = 0700, - - group_read = 040, - group_write = 020, - group_exec = 010, - group_all = 070, - - others_read = 04, - others_write = 02, - others_exec = 01, - others_all = 07, - - all = 0777, - - set_uid = 04000, - set_gid = 02000, - sticky_bit = 01000, - mask = 07777, - unknown = 0xFFFF, -}; - -_LIBCPP_INLINE_VISIBILITY -inline constexpr perms operator&(perms _LHS, perms _RHS) -{ return static_cast(static_cast(_LHS) & static_cast(_RHS)); } - -_LIBCPP_INLINE_VISIBILITY -inline constexpr perms operator|(perms _LHS, perms _RHS) -{ return static_cast(static_cast(_LHS) | static_cast(_RHS)); } - -_LIBCPP_INLINE_VISIBILITY -inline constexpr perms operator^(perms _LHS, perms _RHS) -{ return static_cast(static_cast(_LHS) ^ static_cast(_RHS)); } - -_LIBCPP_INLINE_VISIBILITY -inline constexpr perms operator~(perms _LHS) -{ return static_cast(~static_cast(_LHS)); } - -_LIBCPP_INLINE_VISIBILITY -inline perms& operator&=(perms& _LHS, perms _RHS) -{ return _LHS = _LHS & _RHS; } - -_LIBCPP_INLINE_VISIBILITY -inline perms& operator|=(perms& _LHS, perms _RHS) -{ return _LHS = _LHS | _RHS; } - -_LIBCPP_INLINE_VISIBILITY -inline perms& operator^=(perms& _LHS, perms _RHS) -{ return _LHS = _LHS ^ _RHS; } - -enum class _LIBCPP_ENUM_VIS perm_options : unsigned char { - replace = 1, - add = 2, - remove = 4, - nofollow = 8 -}; - -_LIBCPP_INLINE_VISIBILITY -inline constexpr perm_options operator&(perm_options _LHS, perm_options _RHS) -{ return static_cast(static_cast(_LHS) & static_cast(_RHS)); } - -_LIBCPP_INLINE_VISIBILITY -inline constexpr perm_options operator|(perm_options _LHS, perm_options _RHS) -{ return static_cast(static_cast(_LHS) | static_cast(_RHS)); } - -_LIBCPP_INLINE_VISIBILITY -inline constexpr perm_options operator^(perm_options _LHS, perm_options _RHS) -{ return static_cast(static_cast(_LHS) ^ static_cast(_RHS)); } - -_LIBCPP_INLINE_VISIBILITY -inline constexpr perm_options operator~(perm_options _LHS) -{ return static_cast(~static_cast(_LHS)); } - -_LIBCPP_INLINE_VISIBILITY -inline perm_options& operator&=(perm_options& _LHS, perm_options _RHS) -{ return _LHS = _LHS & _RHS; } - -_LIBCPP_INLINE_VISIBILITY -inline perm_options& operator|=(perm_options& _LHS, perm_options _RHS) -{ return _LHS = _LHS | _RHS; } - -_LIBCPP_INLINE_VISIBILITY -inline perm_options& operator^=(perm_options& _LHS, perm_options _RHS) -{ return _LHS = _LHS ^ _RHS; } - -enum class _LIBCPP_ENUM_VIS copy_options : unsigned short -{ - none = 0, - skip_existing = 1, - overwrite_existing = 2, - update_existing = 4, - recursive = 8, - copy_symlinks = 16, - skip_symlinks = 32, - directories_only = 64, - create_symlinks = 128, - create_hard_links = 256, - __in_recursive_copy = 512, -}; - -_LIBCPP_INLINE_VISIBILITY -inline constexpr copy_options operator&(copy_options _LHS, copy_options _RHS) -{ return static_cast(static_cast(_LHS) & static_cast(_RHS)); } - -_LIBCPP_INLINE_VISIBILITY -inline constexpr copy_options operator|(copy_options _LHS, copy_options _RHS) -{ return static_cast(static_cast(_LHS) | static_cast(_RHS)); } - -_LIBCPP_INLINE_VISIBILITY -inline constexpr copy_options operator^(copy_options _LHS, copy_options _RHS) -{ return static_cast(static_cast(_LHS) ^ static_cast(_RHS)); } - -_LIBCPP_INLINE_VISIBILITY -inline constexpr copy_options operator~(copy_options _LHS) -{ return static_cast(~static_cast(_LHS)); } - -_LIBCPP_INLINE_VISIBILITY -inline copy_options& operator&=(copy_options& _LHS, copy_options _RHS) -{ return _LHS = _LHS & _RHS; } - -_LIBCPP_INLINE_VISIBILITY -inline copy_options& operator|=(copy_options& _LHS, copy_options _RHS) -{ return _LHS = _LHS | _RHS; } - -_LIBCPP_INLINE_VISIBILITY -inline copy_options& operator^=(copy_options& _LHS, copy_options _RHS) -{ return _LHS = _LHS ^ _RHS; } - - -enum class _LIBCPP_ENUM_VIS directory_options : unsigned char -{ - none = 0, - follow_directory_symlink = 1, - skip_permission_denied = 2 -}; - -_LIBCPP_INLINE_VISIBILITY -inline constexpr directory_options operator&(directory_options _LHS, directory_options _RHS) -{ return static_cast(static_cast(_LHS) & static_cast(_RHS)); } - -_LIBCPP_INLINE_VISIBILITY -inline constexpr directory_options operator|(directory_options _LHS, directory_options _RHS) -{ return static_cast(static_cast(_LHS) | static_cast(_RHS)); } - -_LIBCPP_INLINE_VISIBILITY -inline constexpr directory_options operator^(directory_options _LHS, directory_options _RHS) -{ return static_cast(static_cast(_LHS) ^ static_cast(_RHS)); } - -_LIBCPP_INLINE_VISIBILITY -inline constexpr directory_options operator~(directory_options _LHS) -{ return static_cast(~static_cast(_LHS)); } - -_LIBCPP_INLINE_VISIBILITY -inline directory_options& operator&=(directory_options& _LHS, directory_options _RHS) -{ return _LHS = _LHS & _RHS; } - -_LIBCPP_INLINE_VISIBILITY -inline directory_options& operator|=(directory_options& _LHS, directory_options _RHS) -{ return _LHS = _LHS | _RHS; } - -_LIBCPP_INLINE_VISIBILITY -inline directory_options& operator^=(directory_options& _LHS, directory_options _RHS) -{ return _LHS = _LHS ^ _RHS; } - - -class _LIBCPP_TYPE_VIS file_status -{ -public: - // constructors - _LIBCPP_INLINE_VISIBILITY - file_status() noexcept : file_status(file_type::none) {} - _LIBCPP_INLINE_VISIBILITY - explicit file_status(file_type __ft, - perms __prms = perms::unknown) noexcept - : __ft_(__ft), __prms_(__prms) - {} - - file_status(const file_status&) noexcept = default; - file_status(file_status&&) noexcept = default; - - _LIBCPP_INLINE_VISIBILITY - ~file_status() {} - - file_status& operator=(const file_status&) noexcept = default; - file_status& operator=(file_status&&) noexcept = default; - - // observers - _LIBCPP_INLINE_VISIBILITY - file_type type() const noexcept { - return __ft_; - } - - _LIBCPP_INLINE_VISIBILITY - perms permissions() const noexcept { - return __prms_; - } - - // modifiers - _LIBCPP_INLINE_VISIBILITY - void type(file_type __ft) noexcept { - __ft_ = __ft; - } - - _LIBCPP_INLINE_VISIBILITY - void permissions(perms __p) noexcept { - __prms_ = __p; - } -private: - file_type __ft_; - perms __prms_; -}; - -class _LIBCPP_TYPE_VIS directory_entry; - -template struct __can_convert_char { - static const bool value = false; -}; -template struct __can_convert_char - : public __can_convert_char<_Tp> { -}; -template <> struct __can_convert_char { - static const bool value = true; - using __char_type = char; -}; -template <> struct __can_convert_char { - static const bool value = true; - using __char_type = wchar_t; -}; -template <> struct __can_convert_char { - static const bool value = true; - using __char_type = char16_t; -}; -template <> struct __can_convert_char { - static const bool value = true; - using __char_type = char32_t; -}; - -template -typename enable_if<__can_convert_char<_ECharT>::value, bool>::type -__is_separator(_ECharT __e) { - return __e == _ECharT('/'); -}; - -struct _NullSentinal {}; - -template -using _Void = void; - -template -struct __is_pathable_string : public false_type {}; - -template -struct __is_pathable_string, - _Void::__char_type>> -: public __can_convert_char<_ECharT> -{ - using _Str = basic_string<_ECharT, _Traits, _Alloc>; - using _Base = __can_convert_char<_ECharT>; - static _ECharT const* __range_begin(_Str const& __s) { return __s.data(); } - static _ECharT const* __range_end(_Str const& __s) { return __s.data() + __s.length(); } - static _ECharT __first_or_null(_Str const& __s) { - return __s.empty() ? _ECharT{} : __s[0]; - } -}; - - -template -struct __is_pathable_string, - _Void::__char_type>> -: public __can_convert_char<_ECharT> -{ - using _Str = basic_string_view<_ECharT, _Traits>; - using _Base = __can_convert_char<_ECharT>; - static _ECharT const* __range_begin(_Str const& __s) { return __s.data(); } - static _ECharT const* __range_end(_Str const& __s) { return __s.data() + __s.length(); } - static _ECharT __first_or_null(_Str const& __s) { - return __s.empty() ? _ECharT{} : __s[0]; - } -}; - -template ::type, - class _UnqualPtrType = typename remove_const< - typename remove_pointer<_DS>::type>::type, - bool _IsCharPtr = is_pointer<_DS>::value && - __can_convert_char<_UnqualPtrType>::value - > -struct __is_pathable_char_array : false_type {}; - -template -struct __is_pathable_char_array<_Source, _ECharT*, _UPtr, true> - : __can_convert_char::type> -{ - using _Base = __can_convert_char::type>; - - static _ECharT const* __range_begin(const _ECharT* __b) { return __b; } - static _ECharT const* __range_end(const _ECharT* __b) - { - using _Iter = const _ECharT*; - const _ECharT __sentinal = _ECharT{}; - _Iter __e = __b; - for (; *__e != __sentinal; ++__e) - ; - return __e; - } - - static _ECharT __first_or_null(const _ECharT* __b) { return *__b; } -}; - -template ::value, class = void> -struct __is_pathable_iter : false_type {}; - -template -struct __is_pathable_iter<_Iter, true, - _Void::value_type>::__char_type>> - : __can_convert_char::value_type> -{ - using _ECharT = typename iterator_traits<_Iter>::value_type; - using _Base = __can_convert_char<_ECharT>; - - static _Iter __range_begin(_Iter __b) { return __b; } - static _NullSentinal __range_end(_Iter) { return _NullSentinal{}; } - - static _ECharT __first_or_null(_Iter __b) { return *__b; } -}; - -template ::value, - bool _IsCharIterT = __is_pathable_char_array<_Tp>::value, - bool _IsIterT = !_IsCharIterT && __is_pathable_iter<_Tp>::value - > -struct __is_pathable : false_type { - static_assert(!_IsStringT && !_IsCharIterT && !_IsIterT, "Must all be false"); -}; - -template -struct __is_pathable<_Tp, true, false, false> : __is_pathable_string<_Tp> {}; - - -template -struct __is_pathable<_Tp, false, true, false> : __is_pathable_char_array<_Tp> {}; - - -template -struct __is_pathable<_Tp, false, false, true> : __is_pathable_iter<_Tp> {}; - - -template -struct _PathCVT { - static_assert(__can_convert_char<_ECharT>::value, "Char type not convertible"); - - typedef __narrow_to_utf8 _Narrower; - - static void __append_range(string& __dest, _ECharT const* __b, _ECharT const* __e) { - _Narrower()(back_inserter(__dest), __b, __e); - } - - template - static void __append_range(string& __dest, _Iter __b, _Iter __e) { - static_assert(!is_same<_Iter, _ECharT*>::value, "Call const overload"); - if (__b == __e) return; - basic_string<_ECharT> __tmp(__b, __e); - _Narrower()(back_inserter(__dest), __tmp.data(), - __tmp.data() + __tmp.length()); - } - - template - static void __append_range(string& __dest, _Iter __b, _NullSentinal) { - static_assert(!is_same<_Iter, _ECharT*>::value, "Call const overload"); - const _ECharT __sentinal = _ECharT{}; - if (*__b == __sentinal) return; - basic_string<_ECharT> __tmp; - for (; *__b != __sentinal; ++__b) - __tmp.push_back(*__b); - _Narrower()(back_inserter(__dest), __tmp.data(), - __tmp.data() + __tmp.length()); - } - - template - static void __append_source(string& __dest, _Source const& __s) - { - using _Traits = __is_pathable<_Source>; - __append_range(__dest, _Traits::__range_begin(__s), _Traits::__range_end(__s)); - } -}; - -template <> -struct _PathCVT { - - template - static typename enable_if< - __is_exactly_input_iterator<_Iter>::value - >::type __append_range(string& __dest, _Iter __b, _Iter __e) { - for (; __b != __e; ++__b) - __dest.push_back(*__b); - } - - template - static typename enable_if< - __is_forward_iterator<_Iter>::value - >::type __append_range(string& __dest, _Iter __b, _Iter __e) { - __dest.__append_forward_unsafe(__b, __e); - } - - template - static void __append_range(string& __dest, _Iter __b, _NullSentinal) { - const char __sentinal = char{}; - for (; *__b != __sentinal; ++__b) - __dest.push_back(*__b); - } - - template - static void __append_source(string& __dest, _Source const& __s) - { - using _Traits = __is_pathable<_Source>; - __append_range(__dest, _Traits::__range_begin(__s), - _Traits::__range_end(__s)); - } -}; - - -class _LIBCPP_TYPE_VIS path -{ - template - using _EnableIfPathable = typename - enable_if<__is_pathable<_SourceOrIter>::value, _Tp>::type; - - template - using _SourceChar = typename __is_pathable<_Tp>::__char_type; - - template - using _SourceCVT = _PathCVT<_SourceChar<_Tp>>; - -public: - typedef char value_type; - typedef basic_string string_type; - typedef _VSTD::string_view __string_view; - static constexpr value_type preferred_separator = '/'; - - enum class _LIBCPP_ENUM_VIS format : unsigned char { - auto_format, - native_format, - generic_format - }; - - // constructors and destructor - _LIBCPP_INLINE_VISIBILITY path() noexcept {} - _LIBCPP_INLINE_VISIBILITY path(const path& __p) : __pn_(__p.__pn_) {} - _LIBCPP_INLINE_VISIBILITY path(path&& __p) noexcept : __pn_(_VSTD::move(__p.__pn_)) {} - - _LIBCPP_INLINE_VISIBILITY - path(string_type&& __s, format = format::auto_format) noexcept - : __pn_(_VSTD::move(__s)) {} - - template < - class _Source, - class = _EnableIfPathable<_Source, void> - > - path(const _Source& __src, format = format::auto_format) { - _SourceCVT<_Source>::__append_source(__pn_, __src); - } - - template - path(_InputIt __first, _InputIt __last, format = format::auto_format) { - typedef typename iterator_traits<_InputIt>::value_type _ItVal; - _PathCVT<_ItVal>::__append_range(__pn_, __first, __last); - } - - // TODO Implement locale conversions. - template - > - path(const _Source& __src, const locale& __loc, - format = format::auto_format); - template - path(_InputIt __first, _InputIt _last, const locale& __loc, - format = format::auto_format); - - _LIBCPP_INLINE_VISIBILITY - ~path() = default; - - // assignments - _LIBCPP_INLINE_VISIBILITY - path& operator=(const path& __p) { - __pn_ = __p.__pn_; - return *this; - } - - _LIBCPP_INLINE_VISIBILITY - path& operator=(path&& __p) noexcept { - __pn_ = _VSTD::move(__p.__pn_); - return *this; - } - - template - _LIBCPP_INLINE_VISIBILITY - path& operator=(string_type&& __s) noexcept { - __pn_ = _VSTD::move(__s); - return *this; - } - - _LIBCPP_INLINE_VISIBILITY - path& assign(string_type&& __s) noexcept { - __pn_ = _VSTD::move(__s); - return *this; - } - - template - _LIBCPP_INLINE_VISIBILITY - _EnableIfPathable<_Source> - operator=(const _Source& __src) - { return this->assign(__src); } - - - template - _EnableIfPathable<_Source> - assign(const _Source& __src) { - __pn_.clear(); - _SourceCVT<_Source>::__append_source(__pn_, __src); - return *this; - } - - template - path& assign(_InputIt __first, _InputIt __last) { - typedef typename iterator_traits<_InputIt>::value_type _ItVal; - __pn_.clear(); - _PathCVT<_ItVal>::__append_range(__pn_, __first, __last); - return *this; - } - -private: - template - static bool __source_is_absolute(_ECharT __first_or_null) { - return __is_separator(__first_or_null); - } - -public: - // appends - path& operator/=(const path& __p) { - if (__p.is_absolute()) { - __pn_ = __p.__pn_; - return *this; - } - if (has_filename()) - __pn_ += preferred_separator; - __pn_ += __p.native(); - return *this; - } - - // FIXME: Use _LIBCPP_DIAGNOSE_WARNING to produce a diagnostic when __src - // is known at compile time to be "/' since the user almost certainly intended - // to append a separator instead of overwriting the path with "/" - template - _LIBCPP_INLINE_VISIBILITY - _EnableIfPathable<_Source> - operator/=(const _Source& __src) { - return this->append(__src); - } - - template - _EnableIfPathable<_Source> - append(const _Source& __src) { - using _Traits = __is_pathable<_Source>; - using _CVT = _PathCVT<_SourceChar<_Source>>; - if (__source_is_absolute(_Traits::__first_or_null(__src))) - __pn_.clear(); - else if (has_filename()) - __pn_ += preferred_separator; - _CVT::__append_source(__pn_, __src); - return *this; - } - - template - path& append(_InputIt __first, _InputIt __last) { - typedef typename iterator_traits<_InputIt>::value_type _ItVal; - static_assert(__can_convert_char<_ItVal>::value, "Must convertible"); - using _CVT = _PathCVT<_ItVal>; - if (__first != __last && __source_is_absolute(*__first)) - __pn_.clear(); - else if (has_filename()) - __pn_ += preferred_separator; - _CVT::__append_range(__pn_, __first, __last); - return *this; - } - - // concatenation - _LIBCPP_INLINE_VISIBILITY - path& operator+=(const path& __x) { - __pn_ += __x.__pn_; - return *this; - } - - _LIBCPP_INLINE_VISIBILITY - path& operator+=(const string_type& __x) { - __pn_ += __x; - return *this; - } - - _LIBCPP_INLINE_VISIBILITY - path& operator+=(__string_view __x) { - __pn_ += __x; - return *this; - } - - _LIBCPP_INLINE_VISIBILITY - path& operator+=(const value_type* __x) { - __pn_ += __x; - return *this; - } - - _LIBCPP_INLINE_VISIBILITY - path& operator+=(value_type __x) { - __pn_ += __x; - return *this; - } - - template - typename enable_if<__can_convert_char<_ECharT>::value, path&>::type - operator+=(_ECharT __x) - { - basic_string<_ECharT> __tmp; - __tmp += __x; - _PathCVT<_ECharT>::__append_source(__pn_, __tmp); - return *this; - } - - template - _EnableIfPathable<_Source> - operator+=(const _Source& __x) { - return this->concat(__x); - } - - template - _EnableIfPathable<_Source> - concat(const _Source& __x) { - _SourceCVT<_Source>::__append_source(__pn_, __x); - return *this; - } - - template - path& concat(_InputIt __first, _InputIt __last) { - typedef typename iterator_traits<_InputIt>::value_type _ItVal; - _PathCVT<_ItVal>::__append_range(__pn_, __first, __last); - return *this; - } - - // modifiers - _LIBCPP_INLINE_VISIBILITY - void clear() noexcept { - __pn_.clear(); - } - - path& make_preferred() { return *this; } - - _LIBCPP_INLINE_VISIBILITY - path& remove_filename() { - auto __fname = __filename(); - if (!__fname.empty()) - __pn_.erase(__fname.data() - __pn_.data()); - return *this; - } - - path& replace_filename(const path& __replacement) { - remove_filename(); - return (*this /= __replacement); - } - - path& replace_extension(const path& __replacement = path()); - - _LIBCPP_INLINE_VISIBILITY - void swap(path& __rhs) noexcept { - __pn_.swap(__rhs.__pn_); - } - - // private helper to allow reserving memory in the path - _LIBCPP_INLINE_VISIBILITY - void __reserve(size_t __s) { __pn_.reserve(__s); } - - // native format observers - _LIBCPP_INLINE_VISIBILITY - const string_type& native() const noexcept { - return __pn_; - } - - _LIBCPP_INLINE_VISIBILITY - const value_type* c_str() const noexcept { return __pn_.c_str(); } - - _LIBCPP_INLINE_VISIBILITY operator string_type() const { return __pn_; } - - template , - class _Allocator = allocator<_ECharT> > - basic_string<_ECharT, _Traits, _Allocator> - string(const _Allocator& __a = _Allocator()) const { - using _CVT = __widen_from_utf8; - using _Str = basic_string<_ECharT, _Traits, _Allocator>; - _Str __s(__a); - __s.reserve(__pn_.size()); - _CVT()(back_inserter(__s), __pn_.data(), __pn_.data() + __pn_.size()); - return __s; - } - - _LIBCPP_INLINE_VISIBILITY std::string string() const { return __pn_; } - _LIBCPP_INLINE_VISIBILITY std::wstring wstring() const { return string(); } - _LIBCPP_INLINE_VISIBILITY std::string u8string() const { return __pn_; } - _LIBCPP_INLINE_VISIBILITY std::u16string u16string() const { return string(); } - _LIBCPP_INLINE_VISIBILITY std::u32string u32string() const { return string(); } - - // generic format observers - template , - class _Allocator = allocator<_ECharT> - > - basic_string<_ECharT, _Traits, _Allocator> - generic_string(const _Allocator& __a = _Allocator()) const { - return string<_ECharT, _Traits, _Allocator>(__a); - } - - std::string generic_string() const { return __pn_; } - std::wstring generic_wstring() const { return string(); } - std::string generic_u8string() const { return __pn_; } - std::u16string generic_u16string() const { return string(); } - std::u32string generic_u32string() const { return string(); } - -private: - int __compare(__string_view) const; - __string_view __root_name() const; - __string_view __root_directory() const; - __string_view __root_path_raw() const; - __string_view __relative_path() const; - __string_view __parent_path() const; - __string_view __filename() const; - __string_view __stem() const; - __string_view __extension() const; - -public: - // compare - _LIBCPP_INLINE_VISIBILITY int compare(const path& __p) const noexcept { return __compare(__p.__pn_);} - _LIBCPP_INLINE_VISIBILITY int compare(const string_type& __s) const { return __compare(__s); } - _LIBCPP_INLINE_VISIBILITY int compare(__string_view __s) const { return __compare(__s); } - _LIBCPP_INLINE_VISIBILITY int compare(const value_type* __s) const { return __compare(__s); } - - // decomposition - _LIBCPP_INLINE_VISIBILITY path root_name() const { return string_type(__root_name()); } - _LIBCPP_INLINE_VISIBILITY path root_directory() const { return string_type(__root_directory()); } - _LIBCPP_INLINE_VISIBILITY path root_path() const { return root_name().append(string_type(__root_directory())); } - _LIBCPP_INLINE_VISIBILITY path relative_path() const { return string_type(__relative_path()); } - _LIBCPP_INLINE_VISIBILITY path parent_path() const { return string_type(__parent_path()); } - _LIBCPP_INLINE_VISIBILITY path filename() const { return string_type(__filename()); } - _LIBCPP_INLINE_VISIBILITY path stem() const { return string_type(__stem());} - _LIBCPP_INLINE_VISIBILITY path extension() const { return string_type(__extension()); } - - // query - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY - bool empty() const noexcept { return __pn_.empty(); } - - _LIBCPP_INLINE_VISIBILITY bool has_root_name() const { return !__root_name().empty(); } - _LIBCPP_INLINE_VISIBILITY bool has_root_directory() const { return !__root_directory().empty(); } - _LIBCPP_INLINE_VISIBILITY bool has_root_path() const { return !__root_path_raw().empty(); } - _LIBCPP_INLINE_VISIBILITY bool has_relative_path() const { return !__relative_path().empty(); } - _LIBCPP_INLINE_VISIBILITY bool has_parent_path() const { return !__parent_path().empty(); } - _LIBCPP_INLINE_VISIBILITY bool has_filename() const { return !__filename().empty(); } - _LIBCPP_INLINE_VISIBILITY bool has_stem() const { return !__stem().empty(); } - _LIBCPP_INLINE_VISIBILITY bool has_extension() const { return !__extension().empty(); } - - _LIBCPP_INLINE_VISIBILITY bool is_absolute() const { return has_root_directory(); } - _LIBCPP_INLINE_VISIBILITY bool is_relative() const { return !is_absolute(); } - - // relative paths - path lexically_normal() const; - path lexically_relative(const path& __base) const; - - _LIBCPP_INLINE_VISIBILITY path lexically_proximate(const path& __base) const { - path __result = this->lexically_relative(__base); - if (__result.native().empty()) - return *this; - return __result; - } - - // iterators - class _LIBCPP_TYPE_VIS iterator; - typedef iterator const_iterator; - - iterator begin() const; - iterator end() const; - - - template - _LIBCPP_INLINE_VISIBILITY - friend typename enable_if::value && - is_same<_Traits, char_traits>::value, - basic_ostream<_CharT, _Traits>& - >::type - operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) { - __os << std::__quoted(__p.native()); - return __os; - } - - template - _LIBCPP_INLINE_VISIBILITY - friend typename enable_if::value || - !is_same<_Traits, char_traits>::value, - basic_ostream<_CharT, _Traits>& - >::type - operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) { - __os << std::__quoted(__p.string<_CharT, _Traits>()); - return __os; - } - - template - _LIBCPP_INLINE_VISIBILITY - friend basic_istream<_CharT, _Traits>& - operator>>(basic_istream<_CharT, _Traits>& __is, path& __p) - { - basic_string<_CharT, _Traits> __tmp; - __is >> __quoted(__tmp); - __p = __tmp; - return __is; - } - -private: - inline _LIBCPP_INLINE_VISIBILITY - path& __assign_view(__string_view const& __s) noexcept { __pn_ = string_type(__s); return *this; } - string_type __pn_; -}; - -inline _LIBCPP_INLINE_VISIBILITY -void swap(path& __lhs, path& __rhs) noexcept { - __lhs.swap(__rhs); -} - -_LIBCPP_FUNC_VIS -size_t hash_value(const path& __p) noexcept; - -inline _LIBCPP_INLINE_VISIBILITY -bool operator==(const path& __lhs, const path& __rhs) noexcept -{ return __lhs.compare(__rhs) == 0; } - -inline _LIBCPP_INLINE_VISIBILITY -bool operator!=(const path& __lhs, const path& __rhs) noexcept -{ return __lhs.compare(__rhs) != 0; } - -inline _LIBCPP_INLINE_VISIBILITY -bool operator<(const path& __lhs, const path& __rhs) noexcept -{ return __lhs.compare(__rhs) < 0; } - -inline _LIBCPP_INLINE_VISIBILITY -bool operator<=(const path& __lhs, const path& __rhs) noexcept -{ return __lhs.compare(__rhs) <= 0; } - -inline _LIBCPP_INLINE_VISIBILITY -bool operator>(const path& __lhs, const path& __rhs) noexcept -{ return __lhs.compare(__rhs) > 0; } - -inline _LIBCPP_INLINE_VISIBILITY -bool operator>=(const path& __lhs, const path& __rhs) noexcept -{ return __lhs.compare(__rhs) >= 0; } - -inline _LIBCPP_INLINE_VISIBILITY -path operator/(const path& __lhs, const path& __rhs) { - path __result(__lhs); - __result /= __rhs; - return __result; -} - -template -_LIBCPP_INLINE_VISIBILITY -typename enable_if<__is_pathable<_Source>::value, path>::type -u8path(const _Source& __s){ - static_assert(is_same::__char_type, char>::value, - "u8path(Source const&) requires Source have a character type of type 'char'"); - return path(__s); -} - -template -_LIBCPP_INLINE_VISIBILITY -typename enable_if<__is_pathable<_InputIt>::value, path>::type -u8path(_InputIt __f, _InputIt __l) { - static_assert(is_same::__char_type, char>::value, - "u8path(Iter, Iter) requires Iter have a value_type of type 'char'"); - return path(__f, __l); -} - -class _LIBCPP_TYPE_VIS path::iterator -{ -public: - enum _ParserState : unsigned char { - _Singular, - _BeforeBegin, - _InRootName, - _InRootDir, - _InFilenames, - _InTrailingSep, - _AtEnd - }; - -public: - typedef bidirectional_iterator_tag iterator_category; - - typedef path value_type; - typedef std::ptrdiff_t difference_type; - typedef const path* pointer; - typedef const path& reference; - - typedef void __stashing_iterator_tag; // See reverse_iterator and __is_stashing_iterator - -public: - _LIBCPP_INLINE_VISIBILITY - iterator() : __stashed_elem_(), __path_ptr_(nullptr), - __entry_(), __state_(_Singular) {} - - iterator(const iterator&) = default; - ~iterator() = default; - - iterator& operator=(const iterator&) = default; - - _LIBCPP_INLINE_VISIBILITY - reference operator*() const { - return __stashed_elem_; - } - - _LIBCPP_INLINE_VISIBILITY - pointer operator->() const { - return &__stashed_elem_; - } - - _LIBCPP_INLINE_VISIBILITY - iterator& operator++() { - _LIBCPP_ASSERT(__state_ != _Singular, - "attempting to increment a singular iterator"); - _LIBCPP_ASSERT(__state_ != _AtEnd, - "attempting to increment the end iterator"); - return __increment(); - } - - _LIBCPP_INLINE_VISIBILITY - iterator operator++(int) { - iterator __it(*this); - this->operator++(); - return __it; - } - - _LIBCPP_INLINE_VISIBILITY - iterator& operator--() { - _LIBCPP_ASSERT(__state_ != _Singular, - "attempting to decrement a singular iterator"); - _LIBCPP_ASSERT(__entry_.data() != __path_ptr_->native().data(), - "attempting to decrement the begin iterator"); - return __decrement(); - } - - _LIBCPP_INLINE_VISIBILITY - iterator operator--(int) { - iterator __it(*this); - this->operator--(); - return __it; - } - -private: - friend class path; - - inline _LIBCPP_INLINE_VISIBILITY - friend bool operator==(const iterator&, const iterator&); - - iterator& __increment(); - iterator& __decrement(); - - path __stashed_elem_; - const path* __path_ptr_; - path::__string_view __entry_; - _ParserState __state_; -}; - -inline _LIBCPP_INLINE_VISIBILITY -bool operator==(const path::iterator& __lhs, const path::iterator& __rhs) { - return __lhs.__path_ptr_ == __rhs.__path_ptr_ && - __lhs.__entry_.data() == __rhs.__entry_.data(); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool operator!=(const path::iterator& __lhs, const path::iterator& __rhs) { - return !(__lhs == __rhs); -} - -class _LIBCPP_EXCEPTION_ABI filesystem_error : public system_error -{ -public: - _LIBCPP_INLINE_VISIBILITY - filesystem_error(const string& __what, error_code __ec) - : system_error(__ec, __what), - __storage_(make_shared<_Storage>(path(), path())) { - __create_what(0); - } - - _LIBCPP_INLINE_VISIBILITY - filesystem_error(const string& __what, const path& __p1, error_code __ec) - : system_error(__ec, __what), - __storage_(make_shared<_Storage>(__p1, path())) { - __create_what(1); - } - - _LIBCPP_INLINE_VISIBILITY - filesystem_error(const string& __what, const path& __p1, const path& __p2, - error_code __ec) - : system_error(__ec, __what), - __storage_(make_shared<_Storage>(__p1, __p2)) { - __create_what(2); - } - - _LIBCPP_INLINE_VISIBILITY - const path& path1() const noexcept { return __storage_->__p1_; } - - _LIBCPP_INLINE_VISIBILITY - const path& path2() const noexcept { return __storage_->__p2_; } - - ~filesystem_error() override; // key function - - _LIBCPP_INLINE_VISIBILITY - const char* what() const noexcept override { - return __storage_->__what_.c_str(); - } - - _LIBCPP_FUNC_VIS - void __create_what(int __num_paths); - - private: - struct _Storage { - _LIBCPP_INLINE_VISIBILITY - _Storage(const path& __p1, const path& __p2) : __p1_(__p1), __p2_(__p2) {} - - path __p1_; - path __p2_; - string __what_; - }; - shared_ptr<_Storage> __storage_; -}; - -template -_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY -#ifndef _LIBCPP_NO_EXCEPTIONS -void __throw_filesystem_error(_Args && ...__args) -{ - throw filesystem_error(std::forward<_Args>(__args)...); -} -#else -void __throw_filesystem_error(_Args&&...) -{ - _VSTD::abort(); -} -#endif - -// operational functions - -_LIBCPP_FUNC_VIS -path __absolute(const path&, error_code *__ec=nullptr); -_LIBCPP_FUNC_VIS -path __canonical(const path&, error_code *__ec=nullptr); -_LIBCPP_FUNC_VIS -void __copy(const path& __from, const path& __to, copy_options __opt, - error_code *__ec=nullptr); -_LIBCPP_FUNC_VIS -bool __copy_file(const path& __from, const path& __to, copy_options __opt, - error_code *__ec=nullptr); -_LIBCPP_FUNC_VIS -void __copy_symlink(const path& __existing_symlink, const path& __new_symlink, - error_code *__ec=nullptr); -_LIBCPP_FUNC_VIS -bool __create_directories(const path& p, error_code *ec=nullptr); -_LIBCPP_FUNC_VIS -bool __create_directory(const path& p, error_code *ec=nullptr); -_LIBCPP_FUNC_VIS -bool __create_directory(const path& p, const path & attributes, - error_code *ec=nullptr); -_LIBCPP_FUNC_VIS -void __create_directory_symlink(const path& __to, const path& __new_symlink, - error_code *__ec=nullptr); -_LIBCPP_FUNC_VIS -void __create_hard_link(const path& __to, const path& __new_hard_link, - error_code *__ec=nullptr); -_LIBCPP_FUNC_VIS -void __create_symlink(const path& __to, const path& __new_symlink, - error_code *__ec=nullptr); -_LIBCPP_FUNC_VIS -path __current_path(error_code *__ec=nullptr); -_LIBCPP_FUNC_VIS -void __current_path(const path&, error_code *__ec=nullptr); -_LIBCPP_FUNC_VIS -bool __equivalent(const path&, const path&, error_code *__ec=nullptr); -_LIBCPP_FUNC_VIS -uintmax_t __file_size(const path&, error_code *__ec=nullptr); -_LIBCPP_FUNC_VIS -uintmax_t __hard_link_count(const path&, error_code *__ec=nullptr); -_LIBCPP_FUNC_VIS -bool __fs_is_empty(const path& p, error_code *ec=nullptr); -_LIBCPP_FUNC_VIS -file_time_type __last_write_time(const path& p, error_code *ec=nullptr); -_LIBCPP_FUNC_VIS -void __last_write_time(const path& p, file_time_type new_time, - error_code *ec=nullptr); -_LIBCPP_FUNC_VIS -void __permissions(const path&, perms, perm_options, error_code* = nullptr); -_LIBCPP_FUNC_VIS -path __read_symlink(const path& p, error_code *ec=nullptr); -_LIBCPP_FUNC_VIS -bool __remove(const path& p, error_code *ec=nullptr); -_LIBCPP_FUNC_VIS -uintmax_t __remove_all(const path& p, error_code *ec=nullptr); -_LIBCPP_FUNC_VIS -void __rename(const path& from, const path& to, error_code *ec=nullptr); -_LIBCPP_FUNC_VIS -void __resize_file(const path& p, uintmax_t size, error_code *ec=nullptr); -_LIBCPP_FUNC_VIS -space_info __space(const path&, error_code *__ec=nullptr); -_LIBCPP_FUNC_VIS -file_status __status(const path&, error_code *__ec=nullptr); -_LIBCPP_FUNC_VIS -file_status __symlink_status(const path&, error_code *__ec=nullptr); -_LIBCPP_FUNC_VIS -path __system_complete(const path&, error_code *__ec=nullptr); -_LIBCPP_FUNC_VIS -path __temp_directory_path(error_code *__ec=nullptr); -_LIBCPP_FUNC_VIS -path __weakly_canonical(path const& __p, error_code *__ec=nullptr); - -inline _LIBCPP_INLINE_VISIBILITY -path current_path() { - return __current_path(); -} - -inline _LIBCPP_INLINE_VISIBILITY -path current_path(error_code& __ec) { - return __current_path(&__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -void current_path(const path& __p) { - __current_path(__p); -} - -inline _LIBCPP_INLINE_VISIBILITY -void current_path(const path& __p, error_code& __ec) noexcept { - __current_path(__p, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -path absolute(const path& __p) { - return __absolute(__p); -} - -inline _LIBCPP_INLINE_VISIBILITY -path absolute(const path& __p, error_code &__ec) { - return __absolute(__p, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -path canonical(const path& __p) { - return __canonical(__p); -} - -inline _LIBCPP_INLINE_VISIBILITY -path canonical(const path& __p, error_code& __ec) { - return __canonical(__p, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -void copy(const path& __from, const path& __to) { - __copy(__from, __to, copy_options::none); -} - -inline _LIBCPP_INLINE_VISIBILITY -void copy(const path& __from, const path& __to, error_code& __ec) { - __copy(__from, __to, copy_options::none, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -void copy(const path& __from, const path& __to, copy_options __opt) { - __copy(__from, __to, __opt); -} - -inline _LIBCPP_INLINE_VISIBILITY -void copy(const path& __from, const path& __to, - copy_options __opt, error_code& __ec) { - __copy(__from, __to, __opt, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool copy_file(const path& __from, const path& __to) { - return __copy_file(__from, __to, copy_options::none); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool copy_file(const path& __from, const path& __to, error_code& __ec) { - return __copy_file(__from, __to, copy_options::none, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool copy_file(const path& __from, const path& __to, copy_options __opt) { - return __copy_file(__from, __to, __opt); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool copy_file(const path& __from, const path& __to, - copy_options __opt, error_code& __ec){ - return __copy_file(__from, __to, __opt, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -void copy_symlink(const path& __existing, const path& __new) { - __copy_symlink(__existing, __new); -} - -inline _LIBCPP_INLINE_VISIBILITY -void copy_symlink(const path& __ext, const path& __new, error_code& __ec) noexcept { - __copy_symlink(__ext, __new, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool create_directories(const path& __p) { - return __create_directories(__p); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool create_directories(const path& __p, error_code& __ec) { - return __create_directories(__p, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool create_directory(const path& __p) { - return __create_directory(__p); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool create_directory(const path& __p, error_code& __ec) noexcept { - return __create_directory(__p, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool create_directory(const path& __p, const path& __attrs) { - return __create_directory(__p, __attrs); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool create_directory(const path& __p, const path& __attrs, error_code& __ec) noexcept { - return __create_directory(__p, __attrs, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -void create_directory_symlink(const path& __to, const path& __new) { - __create_directory_symlink(__to, __new); -} - -inline _LIBCPP_INLINE_VISIBILITY -void create_directory_symlink(const path& __to, const path& __new, - error_code& __ec) noexcept { - __create_directory_symlink(__to, __new, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -void create_hard_link(const path& __to, const path& __new) { - __create_hard_link(__to, __new); -} - -inline _LIBCPP_INLINE_VISIBILITY -void create_hard_link(const path& __to, const path& __new, error_code& __ec) noexcept { - __create_hard_link(__to, __new, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -void create_symlink(const path& __to, const path& __new) { - __create_symlink(__to, __new); -} - -inline _LIBCPP_INLINE_VISIBILITY -void create_symlink(const path& __to, const path& __new, - error_code& __ec) noexcept { - return __create_symlink(__to, __new, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool status_known(file_status __s) noexcept { - return __s.type() != file_type::none; -} - -inline _LIBCPP_INLINE_VISIBILITY -bool exists(file_status __s) noexcept { - return status_known(__s) && __s.type() != file_type::not_found; -} - -inline _LIBCPP_INLINE_VISIBILITY -bool exists(const path& __p) { - return exists(__status(__p)); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool exists(const path& __p, error_code& __ec) noexcept { - auto __s = __status(__p, &__ec); - if (status_known(__s)) __ec.clear(); - return exists(__s); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool equivalent(const path& __p1, const path& __p2) { - return __equivalent(__p1, __p2); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool equivalent(const path& __p1, const path& __p2, error_code& __ec) noexcept { - return __equivalent(__p1, __p2, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -uintmax_t file_size(const path& __p) { - return __file_size(__p); -} - -inline _LIBCPP_INLINE_VISIBILITY -uintmax_t file_size(const path& __p, error_code& __ec) noexcept { - return __file_size(__p, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -uintmax_t hard_link_count(const path& __p) { - return __hard_link_count(__p); -} - -inline _LIBCPP_INLINE_VISIBILITY -uintmax_t hard_link_count(const path& __p, error_code& __ec) noexcept { - return __hard_link_count(__p, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool is_block_file(file_status __s) noexcept { - return __s.type() == file_type::block; -} - -inline _LIBCPP_INLINE_VISIBILITY -bool is_block_file(const path& __p) { - return is_block_file(__status(__p)); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool is_block_file(const path& __p, error_code& __ec) noexcept { - return is_block_file(__status(__p, &__ec)); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool is_character_file(file_status __s) noexcept { - return __s.type() == file_type::character; -} - -inline _LIBCPP_INLINE_VISIBILITY -bool is_character_file(const path& __p) { - return is_character_file(__status(__p)); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool is_character_file(const path& __p, error_code& __ec) noexcept { - return is_character_file(__status(__p, &__ec)); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool is_directory(file_status __s) noexcept { - return __s.type() == file_type::directory; -} - -inline _LIBCPP_INLINE_VISIBILITY -bool is_directory(const path& __p) { - return is_directory(__status(__p)); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool is_directory(const path& __p, error_code& __ec) noexcept { - return is_directory(__status(__p, &__ec)); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool is_empty(const path& __p) { - return __fs_is_empty(__p); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool is_empty(const path& __p, error_code& __ec) { - return __fs_is_empty(__p, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool is_fifo(file_status __s) noexcept { - return __s.type() == file_type::fifo; -} -inline _LIBCPP_INLINE_VISIBILITY -bool is_fifo(const path& __p) { - return is_fifo(__status(__p)); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool is_fifo(const path& __p, error_code& __ec) noexcept { - return is_fifo(__status(__p, &__ec)); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool is_regular_file(file_status __s) noexcept { - return __s.type() == file_type::regular; -} - -inline _LIBCPP_INLINE_VISIBILITY -bool is_regular_file(const path& __p) { - return is_regular_file(__status(__p)); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool is_regular_file(const path& __p, error_code& __ec) noexcept { - return is_regular_file(__status(__p, &__ec)); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool is_socket(file_status __s) noexcept { - return __s.type() == file_type::socket; -} - -inline _LIBCPP_INLINE_VISIBILITY -bool is_socket(const path& __p) { - return is_socket(__status(__p)); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool is_socket(const path& __p, error_code& __ec) noexcept { - return is_socket(__status(__p, &__ec)); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool is_symlink(file_status __s) noexcept { - return __s.type() == file_type::symlink; -} - -inline _LIBCPP_INLINE_VISIBILITY -bool is_symlink(const path& __p) { - return is_symlink(__symlink_status(__p)); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool is_symlink(const path& __p, error_code& __ec) noexcept { - return is_symlink(__symlink_status(__p, &__ec)); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool is_other(file_status __s) noexcept { - return exists(__s) - && !is_regular_file(__s) && !is_directory(__s) && !is_symlink(__s); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool is_other(const path& __p) { - return is_other(__status(__p)); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool is_other(const path& __p, error_code& __ec) noexcept { - return is_other(__status(__p, &__ec)); -} - -inline _LIBCPP_INLINE_VISIBILITY -file_time_type last_write_time(const path& __p) { - return __last_write_time(__p); -} - -inline _LIBCPP_INLINE_VISIBILITY -file_time_type last_write_time(const path& __p, error_code& __ec) noexcept { - return __last_write_time(__p, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -void last_write_time(const path& __p, file_time_type __t) { - __last_write_time(__p, __t); -} - -inline _LIBCPP_INLINE_VISIBILITY -void last_write_time(const path& __p, file_time_type __t, error_code& __ec) noexcept { - __last_write_time(__p, __t, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -void permissions(const path& __p, perms __prms, - perm_options __opts = perm_options::replace) { - __permissions(__p, __prms, __opts); -} - -inline _LIBCPP_INLINE_VISIBILITY -void permissions(const path& __p, perms __prms, error_code& __ec) noexcept { - __permissions(__p, __prms, perm_options::replace, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -void permissions(const path& __p, perms __prms, perm_options __opts, - error_code& __ec) { - __permissions(__p, __prms, __opts, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -path proximate(const path& __p, const path& __base, error_code& __ec) { - path __tmp = __weakly_canonical(__p, &__ec); - if (__ec) - return {}; - path __tmp_base = __weakly_canonical(__base, &__ec); - if (__ec) - return {}; - return __tmp.lexically_proximate(__tmp_base); -} - -inline _LIBCPP_INLINE_VISIBILITY -path proximate(const path& __p, error_code& __ec) { - return proximate(__p, current_path(), __ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -path proximate(const path& __p, const path& __base = current_path()) { - return __weakly_canonical(__p).lexically_proximate(__weakly_canonical(__base)); -} - -inline _LIBCPP_INLINE_VISIBILITY -path read_symlink(const path& __p) { - return __read_symlink(__p); -} - -inline _LIBCPP_INLINE_VISIBILITY -path read_symlink(const path& __p, error_code& __ec) { - return __read_symlink(__p, &__ec); -} - - -inline _LIBCPP_INLINE_VISIBILITY -path relative(const path& __p, const path& __base, error_code& __ec) { - path __tmp = __weakly_canonical(__p, &__ec); - if (__ec) - return path(); - path __tmpbase = __weakly_canonical(__base, &__ec); - if (__ec) - return path(); - return __tmp.lexically_relative(__tmpbase); -} - -inline _LIBCPP_INLINE_VISIBILITY -path relative(const path& __p, error_code& __ec) { - return relative(__p, current_path(), __ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -path relative(const path& __p, const path& __base=current_path()) { - return __weakly_canonical(__p).lexically_relative(__weakly_canonical(__base)); -} - - -inline _LIBCPP_INLINE_VISIBILITY -bool remove(const path& __p) { - return __remove(__p); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool remove(const path& __p, error_code& __ec) noexcept { - return __remove(__p, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -uintmax_t remove_all(const path& __p) { - return __remove_all(__p); -} - -inline _LIBCPP_INLINE_VISIBILITY -uintmax_t remove_all(const path& __p, error_code& __ec) { - return __remove_all(__p, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -void rename(const path& __from, const path& __to) { - return __rename(__from, __to); -} - -inline _LIBCPP_INLINE_VISIBILITY -void rename(const path& __from, const path& __to, error_code& __ec) noexcept { - return __rename(__from, __to, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -void resize_file(const path& __p, uintmax_t __ns) { - return __resize_file(__p, __ns); -} - -inline _LIBCPP_INLINE_VISIBILITY -void resize_file(const path& __p, uintmax_t __ns, error_code& __ec) noexcept { - return __resize_file(__p, __ns, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -space_info space(const path& __p) { - return __space(__p); -} - -inline _LIBCPP_INLINE_VISIBILITY -space_info space(const path& __p, error_code& __ec) noexcept { - return __space(__p, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -file_status status(const path& __p) { - return __status(__p); -} - -inline _LIBCPP_INLINE_VISIBILITY -file_status status(const path& __p, error_code& __ec) noexcept { - return __status(__p, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -file_status symlink_status(const path& __p) { - return __symlink_status(__p); -} - -inline _LIBCPP_INLINE_VISIBILITY -file_status symlink_status(const path& __p, error_code& __ec) noexcept { - return __symlink_status(__p, &__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -path temp_directory_path() { - return __temp_directory_path(); -} - -inline _LIBCPP_INLINE_VISIBILITY -path temp_directory_path(error_code& __ec) { - return __temp_directory_path(&__ec); -} - -inline _LIBCPP_INLINE_VISIBILITY -path weakly_canonical(path const& __p) { - return __weakly_canonical(__p); -} - -inline _LIBCPP_INLINE_VISIBILITY -path weakly_canonical(path const& __p, error_code& __ec) { - return __weakly_canonical(__p, &__ec); -} - - -class directory_iterator; -class recursive_directory_iterator; -class __dir_stream; - -class directory_entry -{ - typedef _VSTD_FS::path _Path; - -public: - // constructors and destructors - directory_entry() noexcept = default; - directory_entry(directory_entry const&) = default; - directory_entry(directory_entry&&) noexcept = default; - - _LIBCPP_INLINE_VISIBILITY - explicit directory_entry(_Path const& __p) : __p_(__p) { - error_code __ec; - __refresh(&__ec); - } - - _LIBCPP_INLINE_VISIBILITY - directory_entry(_Path const& __p, error_code &__ec) : __p_(__p) { - __refresh(&__ec); - } - - ~directory_entry() {} - - directory_entry& operator=(directory_entry const&) = default; - directory_entry& operator=(directory_entry&&) noexcept = default; - - _LIBCPP_INLINE_VISIBILITY - void assign(_Path const& __p) { - __p_ = __p; - error_code __ec; - __refresh(&__ec); - } - - _LIBCPP_INLINE_VISIBILITY - void assign(_Path const& __p, error_code& __ec) { - __p_ = __p; - __refresh(&__ec); - } - - _LIBCPP_INLINE_VISIBILITY - void replace_filename(_Path const& __p) { - __p_.replace_filename(__p); - error_code __ec; - __refresh(&__ec); - } - - _LIBCPP_INLINE_VISIBILITY - void replace_filename(_Path const& __p, error_code &__ec) { - __p_ = __p_.parent_path() / __p; - __refresh(&__ec); - } - - _LIBCPP_INLINE_VISIBILITY - void refresh() { - __refresh(); - } - - _LIBCPP_INLINE_VISIBILITY - void refresh(error_code& __ec) noexcept { __refresh(&__ec); } - - _LIBCPP_INLINE_VISIBILITY - _Path const& path() const noexcept { - return __p_; - } - - _LIBCPP_INLINE_VISIBILITY - operator const _Path&() const noexcept { - return __p_; - } - - _LIBCPP_INLINE_VISIBILITY - bool exists() const { - return _VSTD_FS::exists(file_status{__get_ft()}); - } - - _LIBCPP_INLINE_VISIBILITY - bool exists(error_code& __ec) const noexcept { - return _VSTD_FS::exists(file_status{__get_ft(&__ec)}); - } - - _LIBCPP_INLINE_VISIBILITY - bool is_block_file() const { - return __get_ft() == file_type::block; - } - - _LIBCPP_INLINE_VISIBILITY - bool is_block_file(error_code& __ec) const noexcept { - return __get_ft(&__ec) == file_type::block; - } - - _LIBCPP_INLINE_VISIBILITY - bool is_character_file() const { - return __get_ft() == file_type::character; - } - - _LIBCPP_INLINE_VISIBILITY - bool is_character_file(error_code& __ec) const noexcept { - return __get_ft(&__ec) == file_type::character; - } - - _LIBCPP_INLINE_VISIBILITY - bool is_directory() const { - return __get_ft() == file_type::directory; - } - - _LIBCPP_INLINE_VISIBILITY - bool is_directory(error_code& __ec) const noexcept { - return __get_ft(&__ec) == file_type::directory; - } - - _LIBCPP_INLINE_VISIBILITY - bool is_fifo() const { - return __get_ft() == file_type::fifo; - } - - _LIBCPP_INLINE_VISIBILITY - bool is_fifo(error_code& __ec) const noexcept { - return __get_ft(&__ec) == file_type::fifo; - } - - _LIBCPP_INLINE_VISIBILITY - bool is_other() const { - return _VSTD_FS::is_other(file_status{__get_ft()}); - } - - _LIBCPP_INLINE_VISIBILITY - bool is_other(error_code& __ec) const noexcept { - return _VSTD_FS::is_other(file_status{__get_ft(&__ec)}); - } - - _LIBCPP_INLINE_VISIBILITY - bool is_regular_file() const { - return __get_ft() == file_type::regular; - } - - _LIBCPP_INLINE_VISIBILITY - bool is_regular_file(error_code& __ec) const noexcept { - return __get_ft(&__ec) == file_type::regular; - } - - _LIBCPP_INLINE_VISIBILITY - bool is_socket() const { - return __get_ft() == file_type::socket; - } - - _LIBCPP_INLINE_VISIBILITY - bool is_socket(error_code& __ec) const noexcept { - return __get_ft(&__ec) == file_type::socket; - } - - _LIBCPP_INLINE_VISIBILITY - bool is_symlink() const { - return __get_sym_ft() == file_type::symlink; - } - - _LIBCPP_INLINE_VISIBILITY - bool is_symlink(error_code& __ec) const noexcept { - return __get_sym_ft(&__ec) == file_type::symlink; - } - _LIBCPP_INLINE_VISIBILITY - uintmax_t file_size() const { - return __get_size(); - } - - _LIBCPP_INLINE_VISIBILITY - uintmax_t file_size(error_code& __ec) const noexcept { - return __get_size(&__ec); - } - - _LIBCPP_INLINE_VISIBILITY - uintmax_t hard_link_count() const { - return __get_nlink(); - } - - _LIBCPP_INLINE_VISIBILITY - uintmax_t hard_link_count(error_code& __ec) const noexcept { - return __get_nlink(&__ec); - } - - _LIBCPP_INLINE_VISIBILITY - file_time_type last_write_time() const { - return __get_write_time(); - } - - _LIBCPP_INLINE_VISIBILITY - file_time_type last_write_time(error_code& __ec) const noexcept { - return __get_write_time(&__ec); - } - - _LIBCPP_INLINE_VISIBILITY - file_status status() const { - return __get_status(); - } - - _LIBCPP_INLINE_VISIBILITY - file_status status(error_code& __ec) const noexcept { - return __get_status(&__ec); - } - - _LIBCPP_INLINE_VISIBILITY - file_status symlink_status() const { - return __get_symlink_status(); - } - - _LIBCPP_INLINE_VISIBILITY - file_status symlink_status(error_code& __ec) const noexcept { - return __get_symlink_status(&__ec); - } - - _LIBCPP_INLINE_VISIBILITY - bool operator< (directory_entry const& __rhs) const noexcept { - return __p_ < __rhs.__p_; - } - - _LIBCPP_INLINE_VISIBILITY - bool operator==(directory_entry const& __rhs) const noexcept { - return __p_ == __rhs.__p_; - } - - _LIBCPP_INLINE_VISIBILITY - bool operator!=(directory_entry const& __rhs) const noexcept { - return __p_ != __rhs.__p_; - } - - _LIBCPP_INLINE_VISIBILITY - bool operator<=(directory_entry const& __rhs) const noexcept { - return __p_ <= __rhs.__p_; - } - - _LIBCPP_INLINE_VISIBILITY - bool operator> (directory_entry const& __rhs) const noexcept { - return __p_ > __rhs.__p_; - } - - _LIBCPP_INLINE_VISIBILITY - bool operator>=(directory_entry const& __rhs) const noexcept { - return __p_ >= __rhs.__p_; - } - -private: - friend class directory_iterator; - friend class recursive_directory_iterator; - friend class __dir_stream; - - enum _CacheType : unsigned char { - _Empty, - _IterSymlink, - _IterNonSymlink, - _RefreshSymlink, - _RefreshSymlinkUnresolved, - _RefreshNonSymlink - }; - - struct __cached_data { - uintmax_t __size_; - uintmax_t __nlink_; - file_time_type __write_time_; - perms __sym_perms_; - perms __non_sym_perms_; - file_type __type_; - _CacheType __cache_type_; - - _LIBCPP_INLINE_VISIBILITY - __cached_data() noexcept { __reset(); } - - _LIBCPP_INLINE_VISIBILITY - void __reset() { - __cache_type_ = _Empty; - __type_ = file_type::none; - __sym_perms_ = __non_sym_perms_ = perms::unknown; - __size_ = __nlink_ = uintmax_t(-1); - __write_time_ = file_time_type::min(); - } - }; - - _LIBCPP_INLINE_VISIBILITY - static __cached_data __create_iter_result(file_type __ft) { - __cached_data __data; - __data.__type_ = __ft; - __data.__cache_type_ = [&]() { - switch (__ft) { - case file_type::none: - return _Empty; - case file_type::symlink: - return _IterSymlink; - default: - return _IterNonSymlink; - } - }(); - return __data; - } - - _LIBCPP_INLINE_VISIBILITY - void __assign_iter_entry(_Path&& __p, __cached_data __dt) { - __p_ = std::move(__p); - __data_ = __dt; - } - - _LIBCPP_FUNC_VIS - error_code __do_refresh() noexcept; - - _LIBCPP_INLINE_VISIBILITY - static bool __is_dne_error(error_code const& __ec) { - if (!__ec) - return true; - switch (static_cast(__ec.value())) { - case errc::no_such_file_or_directory: - case errc::not_a_directory: - return true; - default: - return false; - } - } - - _LIBCPP_INLINE_VISIBILITY - void __handle_error(const char* __msg, error_code* __dest_ec, - error_code const& __ec, - bool __allow_dne = false) const { - if (__dest_ec) { - *__dest_ec = __ec; - return; - } - if (__ec && (!__allow_dne || !__is_dne_error(__ec))) - __throw_filesystem_error(__msg, __p_, __ec); - } - - _LIBCPP_INLINE_VISIBILITY - void __refresh(error_code* __ec = nullptr) { - __handle_error("in directory_entry::refresh", __ec, __do_refresh(), - /*allow_dne*/ true); - } - - _LIBCPP_INLINE_VISIBILITY - file_type __get_sym_ft(error_code *__ec = nullptr) const { - switch (__data_.__cache_type_) { - case _Empty: - return __symlink_status(__p_, __ec).type(); - case _IterSymlink: - case _RefreshSymlink: - case _RefreshSymlinkUnresolved: - if (__ec) - __ec->clear(); - return file_type::symlink; - case _IterNonSymlink: - case _RefreshNonSymlink: - file_status __st(__data_.__type_); - if (__ec && !_VSTD_FS::exists(__st)) - *__ec = make_error_code(errc::no_such_file_or_directory); - else if (__ec) - __ec->clear(); - return __data_.__type_; - } - _LIBCPP_UNREACHABLE(); - } - - _LIBCPP_INLINE_VISIBILITY - file_type __get_ft(error_code *__ec = nullptr) const { - switch (__data_.__cache_type_) { - case _Empty: - case _IterSymlink: - case _RefreshSymlinkUnresolved: - return __status(__p_, __ec).type(); - case _IterNonSymlink: - case _RefreshNonSymlink: - case _RefreshSymlink: { - file_status __st(__data_.__type_); - if (__ec && !_VSTD_FS::exists(__st)) - *__ec = make_error_code(errc::no_such_file_or_directory); - else if (__ec) - __ec->clear(); - return __data_.__type_; - } - } - _LIBCPP_UNREACHABLE(); - } - - _LIBCPP_INLINE_VISIBILITY - file_status __get_status(error_code *__ec = nullptr) const { - switch (__data_.__cache_type_) { - case _Empty: - case _IterNonSymlink: - case _IterSymlink: - case _RefreshSymlinkUnresolved: - return __status(__p_, __ec); - case _RefreshNonSymlink: - case _RefreshSymlink: - return file_status(__get_ft(__ec), __data_.__non_sym_perms_); - } - _LIBCPP_UNREACHABLE(); - } - - _LIBCPP_INLINE_VISIBILITY - file_status __get_symlink_status(error_code *__ec = nullptr) const { - switch (__data_.__cache_type_) { - case _Empty: - case _IterNonSymlink: - case _IterSymlink: - return __symlink_status(__p_, __ec); - case _RefreshNonSymlink: - return file_status(__get_sym_ft(__ec), __data_.__non_sym_perms_); - case _RefreshSymlink: - case _RefreshSymlinkUnresolved: - return file_status(__get_sym_ft(__ec), __data_.__sym_perms_); - } - _LIBCPP_UNREACHABLE(); - } - - - _LIBCPP_INLINE_VISIBILITY - uintmax_t __get_size(error_code *__ec = nullptr) const { - switch (__data_.__cache_type_) { - case _Empty: - case _IterNonSymlink: - case _IterSymlink: - case _RefreshSymlinkUnresolved: - return _VSTD_FS::__file_size(__p_, __ec); - case _RefreshSymlink: - case _RefreshNonSymlink: { - error_code __m_ec; - file_status __st(__get_ft(&__m_ec)); - __handle_error("in directory_entry::file_size", __ec, __m_ec); - if (_VSTD_FS::exists(__st) && !_VSTD_FS::is_regular_file(__st)) { - errc __err_kind = _VSTD_FS::is_directory(__st) ? errc::is_a_directory - : errc::not_supported; - __handle_error("in directory_entry::file_size", __ec, - make_error_code(__err_kind)); - } - return __data_.__size_; - } - } - _LIBCPP_UNREACHABLE(); - } - - _LIBCPP_INLINE_VISIBILITY - uintmax_t __get_nlink(error_code *__ec = nullptr) const { - switch (__data_.__cache_type_) { - case _Empty: - case _IterNonSymlink: - case _IterSymlink: - case _RefreshSymlinkUnresolved: - return _VSTD_FS::__hard_link_count(__p_, __ec); - case _RefreshSymlink: - case _RefreshNonSymlink: { - error_code __m_ec; - (void)__get_ft(&__m_ec); - __handle_error("in directory_entry::hard_link_count", __ec, __m_ec); - return __data_.__nlink_; - } - } - _LIBCPP_UNREACHABLE(); - } - - _LIBCPP_INLINE_VISIBILITY - file_time_type __get_write_time(error_code *__ec = nullptr) const { - switch (__data_.__cache_type_) { - case _Empty: - case _IterNonSymlink: - case _IterSymlink: - case _RefreshSymlinkUnresolved: - return _VSTD_FS::__last_write_time(__p_, __ec); - case _RefreshSymlink: - case _RefreshNonSymlink: { - error_code __m_ec; - file_status __st(__get_ft(&__m_ec)); - __handle_error("in directory_entry::last_write_time", __ec, __m_ec); - if (_VSTD_FS::exists(__st) && - __data_.__write_time_ == file_time_type::min()) - __handle_error("in directory_entry::last_write_time", __ec, - make_error_code(errc::value_too_large)); - return __data_.__write_time_; - } - } - _LIBCPP_UNREACHABLE(); - } -private: - _Path __p_; - __cached_data __data_; -}; - -class __dir_element_proxy { -public: - - inline _LIBCPP_INLINE_VISIBILITY - directory_entry operator*() { return _VSTD::move(__elem_); } - -private: - friend class directory_iterator; - friend class recursive_directory_iterator; - explicit __dir_element_proxy(directory_entry const& __e) : __elem_(__e) {} - __dir_element_proxy(__dir_element_proxy&& __o) : __elem_(_VSTD::move(__o.__elem_)) {} - directory_entry __elem_; -}; - -class directory_iterator -{ -public: - typedef directory_entry value_type; - typedef ptrdiff_t difference_type; - typedef value_type const* pointer; - typedef value_type const& reference; - typedef input_iterator_tag iterator_category; - -public: - //ctor & dtor - directory_iterator() noexcept - { } - - explicit directory_iterator(const path& __p) - : directory_iterator(__p, nullptr) - { } - - directory_iterator(const path& __p, directory_options __opts) - : directory_iterator(__p, nullptr, __opts) - { } - - directory_iterator(const path& __p, error_code& __ec) - : directory_iterator(__p, &__ec) - { } - - directory_iterator(const path& __p, directory_options __opts, - error_code& __ec) - : directory_iterator(__p, &__ec, __opts) - { } - - directory_iterator(const directory_iterator&) = default; - directory_iterator(directory_iterator&&) = default; - directory_iterator& operator=(const directory_iterator&) = default; - - directory_iterator& operator=(directory_iterator&& __o) noexcept { - // non-default implementation provided to support self-move assign. - if (this != &__o) { - __imp_ = _VSTD::move(__o.__imp_); - } - return *this; - } - - ~directory_iterator() = default; - - const directory_entry& operator*() const { - _LIBCPP_ASSERT(__imp_, "The end iterator cannot be dereferenced"); - return __dereference(); - } - - const directory_entry* operator->() const - { return &**this; } - - directory_iterator& operator++() - { return __increment(); } - - __dir_element_proxy operator++(int) { - __dir_element_proxy __p(**this); - __increment(); - return __p; - } - - directory_iterator& increment(error_code& __ec) - { return __increment(&__ec); } - -private: - inline _LIBCPP_INLINE_VISIBILITY - friend bool operator==(const directory_iterator& __lhs, - const directory_iterator& __rhs) noexcept; - - // construct the dir_stream - _LIBCPP_FUNC_VIS - directory_iterator(const path&, error_code *, - directory_options = directory_options::none); - - _LIBCPP_FUNC_VIS - directory_iterator& __increment(error_code * __ec = nullptr); - - _LIBCPP_FUNC_VIS - const directory_entry& __dereference() const; - -private: - shared_ptr<__dir_stream> __imp_; -}; - - -inline _LIBCPP_INLINE_VISIBILITY -bool operator==(const directory_iterator& __lhs, - const directory_iterator& __rhs) noexcept { - return __lhs.__imp_ == __rhs.__imp_; -} - -inline _LIBCPP_INLINE_VISIBILITY -bool operator!=(const directory_iterator& __lhs, - const directory_iterator& __rhs) noexcept { - return !(__lhs == __rhs); -} - -// enable directory_iterator range-based for statements -inline _LIBCPP_INLINE_VISIBILITY -directory_iterator begin(directory_iterator __iter) noexcept { - return __iter; -} - -inline _LIBCPP_INLINE_VISIBILITY -directory_iterator end(const directory_iterator&) noexcept { - return directory_iterator(); -} - -class recursive_directory_iterator { -public: - using value_type = directory_entry; - using difference_type = std::ptrdiff_t; - using pointer = directory_entry const *; - using reference = directory_entry const &; - using iterator_category = std::input_iterator_tag; - -public: - // constructors and destructor - _LIBCPP_INLINE_VISIBILITY - recursive_directory_iterator() noexcept - : __rec_(false) - {} - - _LIBCPP_INLINE_VISIBILITY - explicit recursive_directory_iterator(const path& __p, - directory_options __xoptions = directory_options::none) - : recursive_directory_iterator(__p, __xoptions, nullptr) - { } - - _LIBCPP_INLINE_VISIBILITY - recursive_directory_iterator(const path& __p, - directory_options __xoptions, error_code& __ec) - : recursive_directory_iterator(__p, __xoptions, &__ec) - { } - - _LIBCPP_INLINE_VISIBILITY - recursive_directory_iterator(const path& __p, error_code& __ec) - : recursive_directory_iterator(__p, directory_options::none, &__ec) - { } - - recursive_directory_iterator(const recursive_directory_iterator&) = default; - recursive_directory_iterator(recursive_directory_iterator&&) = default; - - recursive_directory_iterator & - operator=(const recursive_directory_iterator&) = default; - - _LIBCPP_INLINE_VISIBILITY - recursive_directory_iterator & - operator=(recursive_directory_iterator&& __o) noexcept { - // non-default implementation provided to support self-move assign. - if (this != &__o) { - __imp_ = _VSTD::move(__o.__imp_); - __rec_ = __o.__rec_; - } - return *this; - } - - ~recursive_directory_iterator() = default; - - _LIBCPP_INLINE_VISIBILITY - const directory_entry& operator*() const - { return __dereference(); } - - _LIBCPP_INLINE_VISIBILITY - const directory_entry* operator->() const - { return &__dereference(); } - - recursive_directory_iterator& operator++() - { return __increment(); } - - _LIBCPP_INLINE_VISIBILITY - __dir_element_proxy operator++(int) { - __dir_element_proxy __p(**this); - __increment(); - return __p; - } - - _LIBCPP_INLINE_VISIBILITY - recursive_directory_iterator& increment(error_code& __ec) - { return __increment(&__ec); } - - _LIBCPP_FUNC_VIS directory_options options() const; - _LIBCPP_FUNC_VIS int depth() const; - - _LIBCPP_INLINE_VISIBILITY - void pop() { __pop(); } - - _LIBCPP_INLINE_VISIBILITY - void pop(error_code& __ec) - { __pop(&__ec); } - - _LIBCPP_INLINE_VISIBILITY - bool recursion_pending() const - { return __rec_; } - - _LIBCPP_INLINE_VISIBILITY - void disable_recursion_pending() - { __rec_ = false; } - -private: - recursive_directory_iterator(const path& __p, directory_options __opt, - error_code *__ec); - - _LIBCPP_FUNC_VIS - const directory_entry& __dereference() const; - - _LIBCPP_FUNC_VIS - bool __try_recursion(error_code* __ec); - - _LIBCPP_FUNC_VIS - void __advance(error_code* __ec=nullptr); - - _LIBCPP_FUNC_VIS - recursive_directory_iterator& __increment(error_code *__ec=nullptr); - - _LIBCPP_FUNC_VIS - void __pop(error_code* __ec=nullptr); - - inline _LIBCPP_INLINE_VISIBILITY - friend bool operator==(const recursive_directory_iterator&, - const recursive_directory_iterator&) noexcept; - - struct __shared_imp; - shared_ptr<__shared_imp> __imp_; - bool __rec_; -}; // class recursive_directory_iterator - - -inline _LIBCPP_INLINE_VISIBILITY -bool operator==(const recursive_directory_iterator& __lhs, - const recursive_directory_iterator& __rhs) noexcept -{ - return __lhs.__imp_ == __rhs.__imp_; -} - -_LIBCPP_INLINE_VISIBILITY -inline bool operator!=(const recursive_directory_iterator& __lhs, - const recursive_directory_iterator& __rhs) noexcept -{ - return !(__lhs == __rhs); -} -// enable recursive_directory_iterator range-based for statements -inline _LIBCPP_INLINE_VISIBILITY -recursive_directory_iterator begin(recursive_directory_iterator __iter) noexcept { - return __iter; -} - -inline _LIBCPP_INLINE_VISIBILITY -recursive_directory_iterator end(const recursive_directory_iterator&) noexcept { - return recursive_directory_iterator(); -} +using namespace _VSTD_FS; _LIBCPP_END_NAMESPACE_EXPERIMENTAL_FILESYSTEM diff --git a/include/filesystem b/include/filesystem new file mode 100644 index 000000000..aa1d71800 --- /dev/null +++ b/include/filesystem @@ -0,0 +1,2682 @@ +// -*- C++ -*- +//===--------------------------- filesystem -------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +#ifndef _LIBCPP_FILESYSTEM +#define _LIBCPP_FILESYSTEM +/* + filesystem synopsis + + namespace std { namespace filesystem { + + 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 + friend basic_ostream& + operator<<(basic_ostream& os, const path& p); + + template + friend basic_istream& + operator>>(basic_istream& is, path& p); + + template + path u8path(const Source& source); + template + 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; + directory_iterator end(const directory_iterator&) noexcept; + + class recursive_directory_iterator; + + // enable recursive_directory_iterator range-based for statements + recursive_directory_iterator begin(recursive_directory_iterator iter) noexcept; + recursive_directory_iterator end(const recursive_directory_iterator&) noexcept; + + 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 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); + + +} } // namespaces std::filesystem + +*/ + +#include <__config> +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // for quoted +#include + +#include <__debug> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + +#ifndef _LIBCPP_CXX03_LANG + +#if _LIBCPP_STD_VER >= 17 +#define __cpp_lib_filesystem 201703 +#endif + +_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM + +struct _FilesystemClock { +#if !defined(_LIBCPP_HAS_NO_INT128) + typedef __int128_t rep; + typedef nano period; +#else + typedef long long rep; + typedef nano period; +#endif + + typedef chrono::duration duration; + typedef chrono::time_point<_FilesystemClock> time_point; + + static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = false; + + _LIBCPP_FUNC_VIS static time_point now() noexcept; + + _LIBCPP_INLINE_VISIBILITY + static time_t to_time_t(const time_point& __t) noexcept { + typedef chrono::duration __secs; + return time_t( + chrono::duration_cast<__secs>(__t.time_since_epoch()).count()); + } + + _LIBCPP_INLINE_VISIBILITY + static time_point from_time_t(time_t __t) noexcept { + typedef chrono::duration __secs; + return time_point(__secs(__t)); + } +}; + +typedef chrono::time_point<_FilesystemClock> file_time_type; + +struct _LIBCPP_TYPE_VIS space_info { + uintmax_t capacity; + uintmax_t free; + uintmax_t available; +}; + +enum class _LIBCPP_ENUM_VIS file_type : signed char { + none = 0, + not_found = -1, + regular = 1, + directory = 2, + symlink = 3, + block = 4, + character = 5, + fifo = 6, + socket = 7, + unknown = 8 +}; + +enum class _LIBCPP_ENUM_VIS perms : unsigned { + none = 0, + + owner_read = 0400, + owner_write = 0200, + owner_exec = 0100, + owner_all = 0700, + + group_read = 040, + group_write = 020, + group_exec = 010, + group_all = 070, + + others_read = 04, + others_write = 02, + others_exec = 01, + others_all = 07, + + all = 0777, + + set_uid = 04000, + set_gid = 02000, + sticky_bit = 01000, + mask = 07777, + unknown = 0xFFFF, +}; + +_LIBCPP_INLINE_VISIBILITY +inline constexpr perms operator&(perms _LHS, perms _RHS) { + return static_cast(static_cast(_LHS) & + static_cast(_RHS)); +} + +_LIBCPP_INLINE_VISIBILITY +inline constexpr perms operator|(perms _LHS, perms _RHS) { + return static_cast(static_cast(_LHS) | + static_cast(_RHS)); +} + +_LIBCPP_INLINE_VISIBILITY +inline constexpr perms operator^(perms _LHS, perms _RHS) { + return static_cast(static_cast(_LHS) ^ + static_cast(_RHS)); +} + +_LIBCPP_INLINE_VISIBILITY +inline constexpr perms operator~(perms _LHS) { + return static_cast(~static_cast(_LHS)); +} + +_LIBCPP_INLINE_VISIBILITY +inline perms& operator&=(perms& _LHS, perms _RHS) { return _LHS = _LHS & _RHS; } + +_LIBCPP_INLINE_VISIBILITY +inline perms& operator|=(perms& _LHS, perms _RHS) { return _LHS = _LHS | _RHS; } + +_LIBCPP_INLINE_VISIBILITY +inline perms& operator^=(perms& _LHS, perms _RHS) { return _LHS = _LHS ^ _RHS; } + +enum class _LIBCPP_ENUM_VIS perm_options : unsigned char { + replace = 1, + add = 2, + remove = 4, + nofollow = 8 +}; + +_LIBCPP_INLINE_VISIBILITY +inline constexpr perm_options operator&(perm_options _LHS, perm_options _RHS) { + return static_cast(static_cast(_LHS) & + static_cast(_RHS)); +} + +_LIBCPP_INLINE_VISIBILITY +inline constexpr perm_options operator|(perm_options _LHS, perm_options _RHS) { + return static_cast(static_cast(_LHS) | + static_cast(_RHS)); +} + +_LIBCPP_INLINE_VISIBILITY +inline constexpr perm_options operator^(perm_options _LHS, perm_options _RHS) { + return static_cast(static_cast(_LHS) ^ + static_cast(_RHS)); +} + +_LIBCPP_INLINE_VISIBILITY +inline constexpr perm_options operator~(perm_options _LHS) { + return static_cast(~static_cast(_LHS)); +} + +_LIBCPP_INLINE_VISIBILITY +inline perm_options& operator&=(perm_options& _LHS, perm_options _RHS) { + return _LHS = _LHS & _RHS; +} + +_LIBCPP_INLINE_VISIBILITY +inline perm_options& operator|=(perm_options& _LHS, perm_options _RHS) { + return _LHS = _LHS | _RHS; +} + +_LIBCPP_INLINE_VISIBILITY +inline perm_options& operator^=(perm_options& _LHS, perm_options _RHS) { + return _LHS = _LHS ^ _RHS; +} + +enum class _LIBCPP_ENUM_VIS copy_options : unsigned short { + none = 0, + skip_existing = 1, + overwrite_existing = 2, + update_existing = 4, + recursive = 8, + copy_symlinks = 16, + skip_symlinks = 32, + directories_only = 64, + create_symlinks = 128, + create_hard_links = 256, + __in_recursive_copy = 512, +}; + +_LIBCPP_INLINE_VISIBILITY +inline constexpr copy_options operator&(copy_options _LHS, copy_options _RHS) { + return static_cast(static_cast(_LHS) & + static_cast(_RHS)); +} + +_LIBCPP_INLINE_VISIBILITY +inline constexpr copy_options operator|(copy_options _LHS, copy_options _RHS) { + return static_cast(static_cast(_LHS) | + static_cast(_RHS)); +} + +_LIBCPP_INLINE_VISIBILITY +inline constexpr copy_options operator^(copy_options _LHS, copy_options _RHS) { + return static_cast(static_cast(_LHS) ^ + static_cast(_RHS)); +} + +_LIBCPP_INLINE_VISIBILITY +inline constexpr copy_options operator~(copy_options _LHS) { + return static_cast(~static_cast(_LHS)); +} + +_LIBCPP_INLINE_VISIBILITY +inline copy_options& operator&=(copy_options& _LHS, copy_options _RHS) { + return _LHS = _LHS & _RHS; +} + +_LIBCPP_INLINE_VISIBILITY +inline copy_options& operator|=(copy_options& _LHS, copy_options _RHS) { + return _LHS = _LHS | _RHS; +} + +_LIBCPP_INLINE_VISIBILITY +inline copy_options& operator^=(copy_options& _LHS, copy_options _RHS) { + return _LHS = _LHS ^ _RHS; +} + +enum class _LIBCPP_ENUM_VIS directory_options : unsigned char { + none = 0, + follow_directory_symlink = 1, + skip_permission_denied = 2 +}; + +_LIBCPP_INLINE_VISIBILITY +inline constexpr directory_options operator&(directory_options _LHS, + directory_options _RHS) { + return static_cast(static_cast(_LHS) & + static_cast(_RHS)); +} + +_LIBCPP_INLINE_VISIBILITY +inline constexpr directory_options operator|(directory_options _LHS, + directory_options _RHS) { + return static_cast(static_cast(_LHS) | + static_cast(_RHS)); +} + +_LIBCPP_INLINE_VISIBILITY +inline constexpr directory_options operator^(directory_options _LHS, + directory_options _RHS) { + return static_cast(static_cast(_LHS) ^ + static_cast(_RHS)); +} + +_LIBCPP_INLINE_VISIBILITY +inline constexpr directory_options operator~(directory_options _LHS) { + return static_cast(~static_cast(_LHS)); +} + +_LIBCPP_INLINE_VISIBILITY +inline directory_options& operator&=(directory_options& _LHS, + directory_options _RHS) { + return _LHS = _LHS & _RHS; +} + +_LIBCPP_INLINE_VISIBILITY +inline directory_options& operator|=(directory_options& _LHS, + directory_options _RHS) { + return _LHS = _LHS | _RHS; +} + +_LIBCPP_INLINE_VISIBILITY +inline directory_options& operator^=(directory_options& _LHS, + directory_options _RHS) { + return _LHS = _LHS ^ _RHS; +} + +class _LIBCPP_TYPE_VIS file_status { +public: + // constructors + _LIBCPP_INLINE_VISIBILITY + file_status() noexcept : file_status(file_type::none) {} + _LIBCPP_INLINE_VISIBILITY + explicit file_status(file_type __ft, perms __prms = perms::unknown) noexcept + : __ft_(__ft), + __prms_(__prms) {} + + file_status(const file_status&) noexcept = default; + file_status(file_status&&) noexcept = default; + + _LIBCPP_INLINE_VISIBILITY + ~file_status() {} + + file_status& operator=(const file_status&) noexcept = default; + file_status& operator=(file_status&&) noexcept = default; + + // observers + _LIBCPP_INLINE_VISIBILITY + file_type type() const noexcept { return __ft_; } + + _LIBCPP_INLINE_VISIBILITY + perms permissions() const noexcept { return __prms_; } + + // modifiers + _LIBCPP_INLINE_VISIBILITY + void type(file_type __ft) noexcept { __ft_ = __ft; } + + _LIBCPP_INLINE_VISIBILITY + void permissions(perms __p) noexcept { __prms_ = __p; } + +private: + file_type __ft_; + perms __prms_; +}; + +class _LIBCPP_TYPE_VIS directory_entry; + +template +struct __can_convert_char { + static const bool value = false; +}; +template +struct __can_convert_char : public __can_convert_char<_Tp> {}; +template <> +struct __can_convert_char { + static const bool value = true; + using __char_type = char; +}; +template <> +struct __can_convert_char { + static const bool value = true; + using __char_type = wchar_t; +}; +template <> +struct __can_convert_char { + static const bool value = true; + using __char_type = char16_t; +}; +template <> +struct __can_convert_char { + static const bool value = true; + using __char_type = char32_t; +}; + +template +typename enable_if<__can_convert_char<_ECharT>::value, bool>::type +__is_separator(_ECharT __e) { + return __e == _ECharT('/'); +}; + +struct _NullSentinal {}; + +template +using _Void = void; + +template +struct __is_pathable_string : public false_type {}; + +template +struct __is_pathable_string< + basic_string<_ECharT, _Traits, _Alloc>, + _Void::__char_type> > + : public __can_convert_char<_ECharT> { + using _Str = basic_string<_ECharT, _Traits, _Alloc>; + using _Base = __can_convert_char<_ECharT>; + static _ECharT const* __range_begin(_Str const& __s) { return __s.data(); } + static _ECharT const* __range_end(_Str const& __s) { + return __s.data() + __s.length(); + } + static _ECharT __first_or_null(_Str const& __s) { + return __s.empty() ? _ECharT{} : __s[0]; + } +}; + +template +struct __is_pathable_string< + basic_string_view<_ECharT, _Traits>, + _Void::__char_type> > + : public __can_convert_char<_ECharT> { + using _Str = basic_string_view<_ECharT, _Traits>; + using _Base = __can_convert_char<_ECharT>; + static _ECharT const* __range_begin(_Str const& __s) { return __s.data(); } + static _ECharT const* __range_end(_Str const& __s) { + return __s.data() + __s.length(); + } + static _ECharT __first_or_null(_Str const& __s) { + return __s.empty() ? _ECharT{} : __s[0]; + } +}; + +template ::type, + class _UnqualPtrType = + typename remove_const::type>::type, + bool _IsCharPtr = is_pointer<_DS>::value&& + __can_convert_char<_UnqualPtrType>::value> +struct __is_pathable_char_array : false_type {}; + +template +struct __is_pathable_char_array<_Source, _ECharT*, _UPtr, true> + : __can_convert_char::type> { + using _Base = __can_convert_char::type>; + + static _ECharT const* __range_begin(const _ECharT* __b) { return __b; } + static _ECharT const* __range_end(const _ECharT* __b) { + using _Iter = const _ECharT*; + const _ECharT __sentinal = _ECharT{}; + _Iter __e = __b; + for (; *__e != __sentinal; ++__e) + ; + return __e; + } + + static _ECharT __first_or_null(const _ECharT* __b) { return *__b; } +}; + +template ::value, + class = void> +struct __is_pathable_iter : false_type {}; + +template +struct __is_pathable_iter< + _Iter, true, + _Void::value_type>::__char_type> > + : __can_convert_char::value_type> { + using _ECharT = typename iterator_traits<_Iter>::value_type; + using _Base = __can_convert_char<_ECharT>; + + static _Iter __range_begin(_Iter __b) { return __b; } + static _NullSentinal __range_end(_Iter) { return _NullSentinal{}; } + + static _ECharT __first_or_null(_Iter __b) { return *__b; } +}; + +template ::value, + bool _IsCharIterT = __is_pathable_char_array<_Tp>::value, + bool _IsIterT = !_IsCharIterT && __is_pathable_iter<_Tp>::value> +struct __is_pathable : false_type { + static_assert(!_IsStringT && !_IsCharIterT && !_IsIterT, "Must all be false"); +}; + +template +struct __is_pathable<_Tp, true, false, false> : __is_pathable_string<_Tp> {}; + +template +struct __is_pathable<_Tp, false, true, false> : __is_pathable_char_array<_Tp> { +}; + +template +struct __is_pathable<_Tp, false, false, true> : __is_pathable_iter<_Tp> {}; + +template +struct _PathCVT { + static_assert(__can_convert_char<_ECharT>::value, + "Char type not convertible"); + + typedef __narrow_to_utf8 _Narrower; + + static void __append_range(string& __dest, _ECharT const* __b, + _ECharT const* __e) { + _Narrower()(back_inserter(__dest), __b, __e); + } + + template + static void __append_range(string& __dest, _Iter __b, _Iter __e) { + static_assert(!is_same<_Iter, _ECharT*>::value, "Call const overload"); + if (__b == __e) + return; + basic_string<_ECharT> __tmp(__b, __e); + _Narrower()(back_inserter(__dest), __tmp.data(), + __tmp.data() + __tmp.length()); + } + + template + static void __append_range(string& __dest, _Iter __b, _NullSentinal) { + static_assert(!is_same<_Iter, _ECharT*>::value, "Call const overload"); + const _ECharT __sentinal = _ECharT{}; + if (*__b == __sentinal) + return; + basic_string<_ECharT> __tmp; + for (; *__b != __sentinal; ++__b) + __tmp.push_back(*__b); + _Narrower()(back_inserter(__dest), __tmp.data(), + __tmp.data() + __tmp.length()); + } + + template + static void __append_source(string& __dest, _Source const& __s) { + using _Traits = __is_pathable<_Source>; + __append_range(__dest, _Traits::__range_begin(__s), + _Traits::__range_end(__s)); + } +}; + +template <> +struct _PathCVT { + + template + static typename enable_if<__is_exactly_input_iterator<_Iter>::value>::type + __append_range(string& __dest, _Iter __b, _Iter __e) { + for (; __b != __e; ++__b) + __dest.push_back(*__b); + } + + template + static typename enable_if<__is_forward_iterator<_Iter>::value>::type + __append_range(string& __dest, _Iter __b, _Iter __e) { + __dest.__append_forward_unsafe(__b, __e); + } + + template + static void __append_range(string& __dest, _Iter __b, _NullSentinal) { + const char __sentinal = char{}; + for (; *__b != __sentinal; ++__b) + __dest.push_back(*__b); + } + + template + static void __append_source(string& __dest, _Source const& __s) { + using _Traits = __is_pathable<_Source>; + __append_range(__dest, _Traits::__range_begin(__s), + _Traits::__range_end(__s)); + } +}; + +class _LIBCPP_TYPE_VIS path { + template + using _EnableIfPathable = + typename enable_if<__is_pathable<_SourceOrIter>::value, _Tp>::type; + + template + using _SourceChar = typename __is_pathable<_Tp>::__char_type; + + template + using _SourceCVT = _PathCVT<_SourceChar<_Tp> >; + +public: + typedef char value_type; + typedef basic_string string_type; + typedef _VSTD::string_view __string_view; + static constexpr value_type preferred_separator = '/'; + + enum class _LIBCPP_ENUM_VIS format : unsigned char { + auto_format, + native_format, + generic_format + }; + + // constructors and destructor + _LIBCPP_INLINE_VISIBILITY path() noexcept {} + _LIBCPP_INLINE_VISIBILITY path(const path& __p) : __pn_(__p.__pn_) {} + _LIBCPP_INLINE_VISIBILITY path(path&& __p) noexcept + : __pn_(_VSTD::move(__p.__pn_)) {} + + _LIBCPP_INLINE_VISIBILITY + path(string_type&& __s, format = format::auto_format) noexcept + : __pn_(_VSTD::move(__s)) {} + + template > + path(const _Source& __src, format = format::auto_format) { + _SourceCVT<_Source>::__append_source(__pn_, __src); + } + + template + path(_InputIt __first, _InputIt __last, format = format::auto_format) { + typedef typename iterator_traits<_InputIt>::value_type _ItVal; + _PathCVT<_ItVal>::__append_range(__pn_, __first, __last); + } + + // TODO Implement locale conversions. + template > + path(const _Source& __src, const locale& __loc, format = format::auto_format); + template + path(_InputIt __first, _InputIt _last, const locale& __loc, + format = format::auto_format); + + _LIBCPP_INLINE_VISIBILITY + ~path() = default; + + // assignments + _LIBCPP_INLINE_VISIBILITY + path& operator=(const path& __p) { + __pn_ = __p.__pn_; + return *this; + } + + _LIBCPP_INLINE_VISIBILITY + path& operator=(path&& __p) noexcept { + __pn_ = _VSTD::move(__p.__pn_); + return *this; + } + + template + _LIBCPP_INLINE_VISIBILITY path& operator=(string_type&& __s) noexcept { + __pn_ = _VSTD::move(__s); + return *this; + } + + _LIBCPP_INLINE_VISIBILITY + path& assign(string_type&& __s) noexcept { + __pn_ = _VSTD::move(__s); + return *this; + } + + template + _LIBCPP_INLINE_VISIBILITY _EnableIfPathable<_Source> + operator=(const _Source& __src) { + return this->assign(__src); + } + + template + _EnableIfPathable<_Source> assign(const _Source& __src) { + __pn_.clear(); + _SourceCVT<_Source>::__append_source(__pn_, __src); + return *this; + } + + template + path& assign(_InputIt __first, _InputIt __last) { + typedef typename iterator_traits<_InputIt>::value_type _ItVal; + __pn_.clear(); + _PathCVT<_ItVal>::__append_range(__pn_, __first, __last); + return *this; + } + +private: + template + static bool __source_is_absolute(_ECharT __first_or_null) { + return __is_separator(__first_or_null); + } + +public: + // appends + path& operator/=(const path& __p) { + if (__p.is_absolute()) { + __pn_ = __p.__pn_; + return *this; + } + if (has_filename()) + __pn_ += preferred_separator; + __pn_ += __p.native(); + return *this; + } + + // FIXME: Use _LIBCPP_DIAGNOSE_WARNING to produce a diagnostic when __src + // is known at compile time to be "/' since the user almost certainly intended + // to append a separator instead of overwriting the path with "/" + template + _LIBCPP_INLINE_VISIBILITY _EnableIfPathable<_Source> + operator/=(const _Source& __src) { + return this->append(__src); + } + + template + _EnableIfPathable<_Source> append(const _Source& __src) { + using _Traits = __is_pathable<_Source>; + using _CVT = _PathCVT<_SourceChar<_Source> >; + if (__source_is_absolute(_Traits::__first_or_null(__src))) + __pn_.clear(); + else if (has_filename()) + __pn_ += preferred_separator; + _CVT::__append_source(__pn_, __src); + return *this; + } + + template + path& append(_InputIt __first, _InputIt __last) { + typedef typename iterator_traits<_InputIt>::value_type _ItVal; + static_assert(__can_convert_char<_ItVal>::value, "Must convertible"); + using _CVT = _PathCVT<_ItVal>; + if (__first != __last && __source_is_absolute(*__first)) + __pn_.clear(); + else if (has_filename()) + __pn_ += preferred_separator; + _CVT::__append_range(__pn_, __first, __last); + return *this; + } + + // concatenation + _LIBCPP_INLINE_VISIBILITY + path& operator+=(const path& __x) { + __pn_ += __x.__pn_; + return *this; + } + + _LIBCPP_INLINE_VISIBILITY + path& operator+=(const string_type& __x) { + __pn_ += __x; + return *this; + } + + _LIBCPP_INLINE_VISIBILITY + path& operator+=(__string_view __x) { + __pn_ += __x; + return *this; + } + + _LIBCPP_INLINE_VISIBILITY + path& operator+=(const value_type* __x) { + __pn_ += __x; + return *this; + } + + _LIBCPP_INLINE_VISIBILITY + path& operator+=(value_type __x) { + __pn_ += __x; + return *this; + } + + template + typename enable_if<__can_convert_char<_ECharT>::value, path&>::type + operator+=(_ECharT __x) { + basic_string<_ECharT> __tmp; + __tmp += __x; + _PathCVT<_ECharT>::__append_source(__pn_, __tmp); + return *this; + } + + template + _EnableIfPathable<_Source> operator+=(const _Source& __x) { + return this->concat(__x); + } + + template + _EnableIfPathable<_Source> concat(const _Source& __x) { + _SourceCVT<_Source>::__append_source(__pn_, __x); + return *this; + } + + template + path& concat(_InputIt __first, _InputIt __last) { + typedef typename iterator_traits<_InputIt>::value_type _ItVal; + _PathCVT<_ItVal>::__append_range(__pn_, __first, __last); + return *this; + } + + // modifiers + _LIBCPP_INLINE_VISIBILITY + void clear() noexcept { __pn_.clear(); } + + path& make_preferred() { return *this; } + + _LIBCPP_INLINE_VISIBILITY + path& remove_filename() { + auto __fname = __filename(); + if (!__fname.empty()) + __pn_.erase(__fname.data() - __pn_.data()); + return *this; + } + + path& replace_filename(const path& __replacement) { + remove_filename(); + return (*this /= __replacement); + } + + path& replace_extension(const path& __replacement = path()); + + _LIBCPP_INLINE_VISIBILITY + void swap(path& __rhs) noexcept { __pn_.swap(__rhs.__pn_); } + + // private helper to allow reserving memory in the path + _LIBCPP_INLINE_VISIBILITY + void __reserve(size_t __s) { __pn_.reserve(__s); } + + // native format observers + _LIBCPP_INLINE_VISIBILITY + const string_type& native() const noexcept { return __pn_; } + + _LIBCPP_INLINE_VISIBILITY + const value_type* c_str() const noexcept { return __pn_.c_str(); } + + _LIBCPP_INLINE_VISIBILITY operator string_type() const { return __pn_; } + + template , + class _Allocator = allocator<_ECharT> > + basic_string<_ECharT, _Traits, _Allocator> + string(const _Allocator& __a = _Allocator()) const { + using _CVT = __widen_from_utf8; + using _Str = basic_string<_ECharT, _Traits, _Allocator>; + _Str __s(__a); + __s.reserve(__pn_.size()); + _CVT()(back_inserter(__s), __pn_.data(), __pn_.data() + __pn_.size()); + return __s; + } + + _LIBCPP_INLINE_VISIBILITY std::string string() const { return __pn_; } + _LIBCPP_INLINE_VISIBILITY std::wstring wstring() const { + return string(); + } + _LIBCPP_INLINE_VISIBILITY std::string u8string() const { return __pn_; } + _LIBCPP_INLINE_VISIBILITY std::u16string u16string() const { + return string(); + } + _LIBCPP_INLINE_VISIBILITY std::u32string u32string() const { + return string(); + } + + // generic format observers + template , + class _Allocator = allocator<_ECharT> > + basic_string<_ECharT, _Traits, _Allocator> + generic_string(const _Allocator& __a = _Allocator()) const { + return string<_ECharT, _Traits, _Allocator>(__a); + } + + std::string generic_string() const { return __pn_; } + std::wstring generic_wstring() const { return string(); } + std::string generic_u8string() const { return __pn_; } + std::u16string generic_u16string() const { return string(); } + std::u32string generic_u32string() const { return string(); } + +private: + int __compare(__string_view) const; + __string_view __root_name() const; + __string_view __root_directory() const; + __string_view __root_path_raw() const; + __string_view __relative_path() const; + __string_view __parent_path() const; + __string_view __filename() const; + __string_view __stem() const; + __string_view __extension() const; + +public: + // compare + _LIBCPP_INLINE_VISIBILITY int compare(const path& __p) const noexcept { + return __compare(__p.__pn_); + } + _LIBCPP_INLINE_VISIBILITY int compare(const string_type& __s) const { + return __compare(__s); + } + _LIBCPP_INLINE_VISIBILITY int compare(__string_view __s) const { + return __compare(__s); + } + _LIBCPP_INLINE_VISIBILITY int compare(const value_type* __s) const { + return __compare(__s); + } + + // decomposition + _LIBCPP_INLINE_VISIBILITY path root_name() const { + return string_type(__root_name()); + } + _LIBCPP_INLINE_VISIBILITY path root_directory() const { + return string_type(__root_directory()); + } + _LIBCPP_INLINE_VISIBILITY path root_path() const { + return root_name().append(string_type(__root_directory())); + } + _LIBCPP_INLINE_VISIBILITY path relative_path() const { + return string_type(__relative_path()); + } + _LIBCPP_INLINE_VISIBILITY path parent_path() const { + return string_type(__parent_path()); + } + _LIBCPP_INLINE_VISIBILITY path filename() const { + return string_type(__filename()); + } + _LIBCPP_INLINE_VISIBILITY path stem() const { return string_type(__stem()); } + _LIBCPP_INLINE_VISIBILITY path extension() const { + return string_type(__extension()); + } + + // query + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY bool + empty() const noexcept { + return __pn_.empty(); + } + + _LIBCPP_INLINE_VISIBILITY bool has_root_name() const { + return !__root_name().empty(); + } + _LIBCPP_INLINE_VISIBILITY bool has_root_directory() const { + return !__root_directory().empty(); + } + _LIBCPP_INLINE_VISIBILITY bool has_root_path() const { + return !__root_path_raw().empty(); + } + _LIBCPP_INLINE_VISIBILITY bool has_relative_path() const { + return !__relative_path().empty(); + } + _LIBCPP_INLINE_VISIBILITY bool has_parent_path() const { + return !__parent_path().empty(); + } + _LIBCPP_INLINE_VISIBILITY bool has_filename() const { + return !__filename().empty(); + } + _LIBCPP_INLINE_VISIBILITY bool has_stem() const { return !__stem().empty(); } + _LIBCPP_INLINE_VISIBILITY bool has_extension() const { + return !__extension().empty(); + } + + _LIBCPP_INLINE_VISIBILITY bool is_absolute() const { + return has_root_directory(); + } + _LIBCPP_INLINE_VISIBILITY bool is_relative() const { return !is_absolute(); } + + // relative paths + path lexically_normal() const; + path lexically_relative(const path& __base) const; + + _LIBCPP_INLINE_VISIBILITY path lexically_proximate(const path& __base) const { + path __result = this->lexically_relative(__base); + if (__result.native().empty()) + return *this; + return __result; + } + + // iterators + class _LIBCPP_TYPE_VIS iterator; + typedef iterator const_iterator; + + iterator begin() const; + iterator end() const; + + template + _LIBCPP_INLINE_VISIBILITY friend + typename enable_if::value && + is_same<_Traits, char_traits >::value, + basic_ostream<_CharT, _Traits>&>::type + operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) { + __os << std::__quoted(__p.native()); + return __os; + } + + template + _LIBCPP_INLINE_VISIBILITY friend + typename enable_if::value || + !is_same<_Traits, char_traits >::value, + basic_ostream<_CharT, _Traits>&>::type + operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) { + __os << std::__quoted(__p.string<_CharT, _Traits>()); + return __os; + } + + template + _LIBCPP_INLINE_VISIBILITY friend basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __is, path& __p) { + basic_string<_CharT, _Traits> __tmp; + __is >> __quoted(__tmp); + __p = __tmp; + return __is; + } + +private: + inline _LIBCPP_INLINE_VISIBILITY path& + __assign_view(__string_view const& __s) noexcept { + __pn_ = string_type(__s); + return *this; + } + string_type __pn_; +}; + +inline _LIBCPP_INLINE_VISIBILITY void swap(path& __lhs, path& __rhs) noexcept { + __lhs.swap(__rhs); +} + +_LIBCPP_FUNC_VIS +size_t hash_value(const path& __p) noexcept; + +inline _LIBCPP_INLINE_VISIBILITY bool operator==(const path& __lhs, + const path& __rhs) noexcept { + return __lhs.compare(__rhs) == 0; +} + +inline _LIBCPP_INLINE_VISIBILITY bool operator!=(const path& __lhs, + const path& __rhs) noexcept { + return __lhs.compare(__rhs) != 0; +} + +inline _LIBCPP_INLINE_VISIBILITY bool operator<(const path& __lhs, + const path& __rhs) noexcept { + return __lhs.compare(__rhs) < 0; +} + +inline _LIBCPP_INLINE_VISIBILITY bool operator<=(const path& __lhs, + const path& __rhs) noexcept { + return __lhs.compare(__rhs) <= 0; +} + +inline _LIBCPP_INLINE_VISIBILITY bool operator>(const path& __lhs, + const path& __rhs) noexcept { + return __lhs.compare(__rhs) > 0; +} + +inline _LIBCPP_INLINE_VISIBILITY bool operator>=(const path& __lhs, + const path& __rhs) noexcept { + return __lhs.compare(__rhs) >= 0; +} + +inline _LIBCPP_INLINE_VISIBILITY path operator/(const path& __lhs, + const path& __rhs) { + path __result(__lhs); + __result /= __rhs; + return __result; +} + +template +_LIBCPP_INLINE_VISIBILITY + typename enable_if<__is_pathable<_Source>::value, path>::type + u8path(const _Source& __s) { + static_assert( + is_same::__char_type, char>::value, + "u8path(Source const&) requires Source have a character type of type " + "'char'"); + return path(__s); +} + +template +_LIBCPP_INLINE_VISIBILITY + typename enable_if<__is_pathable<_InputIt>::value, path>::type + u8path(_InputIt __f, _InputIt __l) { + static_assert( + is_same::__char_type, char>::value, + "u8path(Iter, Iter) requires Iter have a value_type of type 'char'"); + return path(__f, __l); +} + +class _LIBCPP_TYPE_VIS path::iterator { +public: + enum _ParserState : unsigned char { + _Singular, + _BeforeBegin, + _InRootName, + _InRootDir, + _InFilenames, + _InTrailingSep, + _AtEnd + }; + +public: + typedef bidirectional_iterator_tag iterator_category; + + typedef path value_type; + typedef std::ptrdiff_t difference_type; + typedef const path* pointer; + typedef const path& reference; + + typedef void + __stashing_iterator_tag; // See reverse_iterator and __is_stashing_iterator + +public: + _LIBCPP_INLINE_VISIBILITY + iterator() + : __stashed_elem_(), __path_ptr_(nullptr), __entry_(), + __state_(_Singular) {} + + iterator(const iterator&) = default; + ~iterator() = default; + + iterator& operator=(const iterator&) = default; + + _LIBCPP_INLINE_VISIBILITY + reference operator*() const { return __stashed_elem_; } + + _LIBCPP_INLINE_VISIBILITY + pointer operator->() const { return &__stashed_elem_; } + + _LIBCPP_INLINE_VISIBILITY + iterator& operator++() { + _LIBCPP_ASSERT(__state_ != _Singular, + "attempting to increment a singular iterator"); + _LIBCPP_ASSERT(__state_ != _AtEnd, + "attempting to increment the end iterator"); + return __increment(); + } + + _LIBCPP_INLINE_VISIBILITY + iterator operator++(int) { + iterator __it(*this); + this->operator++(); + return __it; + } + + _LIBCPP_INLINE_VISIBILITY + iterator& operator--() { + _LIBCPP_ASSERT(__state_ != _Singular, + "attempting to decrement a singular iterator"); + _LIBCPP_ASSERT(__entry_.data() != __path_ptr_->native().data(), + "attempting to decrement the begin iterator"); + return __decrement(); + } + + _LIBCPP_INLINE_VISIBILITY + iterator operator--(int) { + iterator __it(*this); + this->operator--(); + return __it; + } + +private: + friend class path; + + inline _LIBCPP_INLINE_VISIBILITY friend bool operator==(const iterator&, + const iterator&); + + iterator& __increment(); + iterator& __decrement(); + + path __stashed_elem_; + const path* __path_ptr_; + path::__string_view __entry_; + _ParserState __state_; +}; + +inline _LIBCPP_INLINE_VISIBILITY bool operator==(const path::iterator& __lhs, + const path::iterator& __rhs) { + return __lhs.__path_ptr_ == __rhs.__path_ptr_ && + __lhs.__entry_.data() == __rhs.__entry_.data(); +} + +inline _LIBCPP_INLINE_VISIBILITY bool operator!=(const path::iterator& __lhs, + const path::iterator& __rhs) { + return !(__lhs == __rhs); +} + +class _LIBCPP_EXCEPTION_ABI filesystem_error : public system_error { +public: + _LIBCPP_INLINE_VISIBILITY + filesystem_error(const string& __what, error_code __ec) + : system_error(__ec, __what), + __storage_(make_shared<_Storage>(path(), path())) { + __create_what(0); + } + + _LIBCPP_INLINE_VISIBILITY + filesystem_error(const string& __what, const path& __p1, error_code __ec) + : system_error(__ec, __what), + __storage_(make_shared<_Storage>(__p1, path())) { + __create_what(1); + } + + _LIBCPP_INLINE_VISIBILITY + filesystem_error(const string& __what, const path& __p1, const path& __p2, + error_code __ec) + : system_error(__ec, __what), + __storage_(make_shared<_Storage>(__p1, __p2)) { + __create_what(2); + } + + _LIBCPP_INLINE_VISIBILITY + const path& path1() const noexcept { return __storage_->__p1_; } + + _LIBCPP_INLINE_VISIBILITY + const path& path2() const noexcept { return __storage_->__p2_; } + + ~filesystem_error() override; // key function + + _LIBCPP_INLINE_VISIBILITY + const char* what() const noexcept override { + return __storage_->__what_.c_str(); + } + + _LIBCPP_FUNC_VIS + void __create_what(int __num_paths); + +private: + struct _Storage { + _LIBCPP_INLINE_VISIBILITY + _Storage(const path& __p1, const path& __p2) : __p1_(__p1), __p2_(__p2) {} + + path __p1_; + path __p2_; + string __what_; + }; + shared_ptr<_Storage> __storage_; +}; + +template +_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY +#ifndef _LIBCPP_NO_EXCEPTIONS + void + __throw_filesystem_error(_Args&&... __args) { + throw filesystem_error(std::forward<_Args>(__args)...); +} +#else + void + __throw_filesystem_error(_Args&&...) { + _VSTD::abort(); +} +#endif + +// operational functions + +_LIBCPP_FUNC_VIS +path __absolute(const path&, error_code* __ec = nullptr); +_LIBCPP_FUNC_VIS +path __canonical(const path&, error_code* __ec = nullptr); +_LIBCPP_FUNC_VIS +void __copy(const path& __from, const path& __to, copy_options __opt, + error_code* __ec = nullptr); +_LIBCPP_FUNC_VIS +bool __copy_file(const path& __from, const path& __to, copy_options __opt, + error_code* __ec = nullptr); +_LIBCPP_FUNC_VIS +void __copy_symlink(const path& __existing_symlink, const path& __new_symlink, + error_code* __ec = nullptr); +_LIBCPP_FUNC_VIS +bool __create_directories(const path& p, error_code* ec = nullptr); +_LIBCPP_FUNC_VIS +bool __create_directory(const path& p, error_code* ec = nullptr); +_LIBCPP_FUNC_VIS +bool __create_directory(const path& p, const path& attributes, + error_code* ec = nullptr); +_LIBCPP_FUNC_VIS +void __create_directory_symlink(const path& __to, const path& __new_symlink, + error_code* __ec = nullptr); +_LIBCPP_FUNC_VIS +void __create_hard_link(const path& __to, const path& __new_hard_link, + error_code* __ec = nullptr); +_LIBCPP_FUNC_VIS +void __create_symlink(const path& __to, const path& __new_symlink, + error_code* __ec = nullptr); +_LIBCPP_FUNC_VIS +path __current_path(error_code* __ec = nullptr); +_LIBCPP_FUNC_VIS +void __current_path(const path&, error_code* __ec = nullptr); +_LIBCPP_FUNC_VIS +bool __equivalent(const path&, const path&, error_code* __ec = nullptr); +_LIBCPP_FUNC_VIS +uintmax_t __file_size(const path&, error_code* __ec = nullptr); +_LIBCPP_FUNC_VIS +uintmax_t __hard_link_count(const path&, error_code* __ec = nullptr); +_LIBCPP_FUNC_VIS +bool __fs_is_empty(const path& p, error_code* ec = nullptr); +_LIBCPP_FUNC_VIS +file_time_type __last_write_time(const path& p, error_code* ec = nullptr); +_LIBCPP_FUNC_VIS +void __last_write_time(const path& p, file_time_type new_time, + error_code* ec = nullptr); +_LIBCPP_FUNC_VIS +void __permissions(const path&, perms, perm_options, error_code* = nullptr); +_LIBCPP_FUNC_VIS +path __read_symlink(const path& p, error_code* ec = nullptr); +_LIBCPP_FUNC_VIS +bool __remove(const path& p, error_code* ec = nullptr); +_LIBCPP_FUNC_VIS +uintmax_t __remove_all(const path& p, error_code* ec = nullptr); +_LIBCPP_FUNC_VIS +void __rename(const path& from, const path& to, error_code* ec = nullptr); +_LIBCPP_FUNC_VIS +void __resize_file(const path& p, uintmax_t size, error_code* ec = nullptr); +_LIBCPP_FUNC_VIS +space_info __space(const path&, error_code* __ec = nullptr); +_LIBCPP_FUNC_VIS +file_status __status(const path&, error_code* __ec = nullptr); +_LIBCPP_FUNC_VIS +file_status __symlink_status(const path&, error_code* __ec = nullptr); +_LIBCPP_FUNC_VIS +path __system_complete(const path&, error_code* __ec = nullptr); +_LIBCPP_FUNC_VIS +path __temp_directory_path(error_code* __ec = nullptr); +_LIBCPP_FUNC_VIS +path __weakly_canonical(path const& __p, error_code* __ec = nullptr); + +inline _LIBCPP_INLINE_VISIBILITY path current_path() { + return __current_path(); +} + +inline _LIBCPP_INLINE_VISIBILITY path current_path(error_code& __ec) { + return __current_path(&__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY void current_path(const path& __p) { + __current_path(__p); +} + +inline _LIBCPP_INLINE_VISIBILITY void current_path(const path& __p, + error_code& __ec) noexcept { + __current_path(__p, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY path absolute(const path& __p) { + return __absolute(__p); +} + +inline _LIBCPP_INLINE_VISIBILITY path absolute(const path& __p, + error_code& __ec) { + return __absolute(__p, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY path canonical(const path& __p) { + return __canonical(__p); +} + +inline _LIBCPP_INLINE_VISIBILITY path canonical(const path& __p, + error_code& __ec) { + return __canonical(__p, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY void copy(const path& __from, + const path& __to) { + __copy(__from, __to, copy_options::none); +} + +inline _LIBCPP_INLINE_VISIBILITY void copy(const path& __from, const path& __to, + error_code& __ec) { + __copy(__from, __to, copy_options::none, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY void copy(const path& __from, const path& __to, + copy_options __opt) { + __copy(__from, __to, __opt); +} + +inline _LIBCPP_INLINE_VISIBILITY void copy(const path& __from, const path& __to, + copy_options __opt, + error_code& __ec) { + __copy(__from, __to, __opt, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY bool copy_file(const path& __from, + const path& __to) { + return __copy_file(__from, __to, copy_options::none); +} + +inline _LIBCPP_INLINE_VISIBILITY bool +copy_file(const path& __from, const path& __to, error_code& __ec) { + return __copy_file(__from, __to, copy_options::none, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY bool +copy_file(const path& __from, const path& __to, copy_options __opt) { + return __copy_file(__from, __to, __opt); +} + +inline _LIBCPP_INLINE_VISIBILITY bool copy_file(const path& __from, + const path& __to, + copy_options __opt, + error_code& __ec) { + return __copy_file(__from, __to, __opt, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY void copy_symlink(const path& __existing, + const path& __new) { + __copy_symlink(__existing, __new); +} + +inline _LIBCPP_INLINE_VISIBILITY void +copy_symlink(const path& __ext, const path& __new, error_code& __ec) noexcept { + __copy_symlink(__ext, __new, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY bool create_directories(const path& __p) { + return __create_directories(__p); +} + +inline _LIBCPP_INLINE_VISIBILITY bool create_directories(const path& __p, + error_code& __ec) { + return __create_directories(__p, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY bool create_directory(const path& __p) { + return __create_directory(__p); +} + +inline _LIBCPP_INLINE_VISIBILITY bool +create_directory(const path& __p, error_code& __ec) noexcept { + return __create_directory(__p, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY bool create_directory(const path& __p, + const path& __attrs) { + return __create_directory(__p, __attrs); +} + +inline _LIBCPP_INLINE_VISIBILITY bool +create_directory(const path& __p, const path& __attrs, + error_code& __ec) noexcept { + return __create_directory(__p, __attrs, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY void +create_directory_symlink(const path& __to, const path& __new) { + __create_directory_symlink(__to, __new); +} + +inline _LIBCPP_INLINE_VISIBILITY void +create_directory_symlink(const path& __to, const path& __new, + error_code& __ec) noexcept { + __create_directory_symlink(__to, __new, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY void create_hard_link(const path& __to, + const path& __new) { + __create_hard_link(__to, __new); +} + +inline _LIBCPP_INLINE_VISIBILITY void +create_hard_link(const path& __to, const path& __new, + error_code& __ec) noexcept { + __create_hard_link(__to, __new, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY void create_symlink(const path& __to, + const path& __new) { + __create_symlink(__to, __new); +} + +inline _LIBCPP_INLINE_VISIBILITY void +create_symlink(const path& __to, const path& __new, error_code& __ec) noexcept { + return __create_symlink(__to, __new, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY bool status_known(file_status __s) noexcept { + return __s.type() != file_type::none; +} + +inline _LIBCPP_INLINE_VISIBILITY bool exists(file_status __s) noexcept { + return status_known(__s) && __s.type() != file_type::not_found; +} + +inline _LIBCPP_INLINE_VISIBILITY bool exists(const path& __p) { + return exists(__status(__p)); +} + +inline _LIBCPP_INLINE_VISIBILITY bool exists(const path& __p, + error_code& __ec) noexcept { + auto __s = __status(__p, &__ec); + if (status_known(__s)) + __ec.clear(); + return exists(__s); +} + +inline _LIBCPP_INLINE_VISIBILITY bool equivalent(const path& __p1, + const path& __p2) { + return __equivalent(__p1, __p2); +} + +inline _LIBCPP_INLINE_VISIBILITY bool +equivalent(const path& __p1, const path& __p2, error_code& __ec) noexcept { + return __equivalent(__p1, __p2, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY uintmax_t file_size(const path& __p) { + return __file_size(__p); +} + +inline _LIBCPP_INLINE_VISIBILITY uintmax_t +file_size(const path& __p, error_code& __ec) noexcept { + return __file_size(__p, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY uintmax_t hard_link_count(const path& __p) { + return __hard_link_count(__p); +} + +inline _LIBCPP_INLINE_VISIBILITY uintmax_t +hard_link_count(const path& __p, error_code& __ec) noexcept { + return __hard_link_count(__p, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY bool is_block_file(file_status __s) noexcept { + return __s.type() == file_type::block; +} + +inline _LIBCPP_INLINE_VISIBILITY bool is_block_file(const path& __p) { + return is_block_file(__status(__p)); +} + +inline _LIBCPP_INLINE_VISIBILITY bool is_block_file(const path& __p, + error_code& __ec) noexcept { + return is_block_file(__status(__p, &__ec)); +} + +inline _LIBCPP_INLINE_VISIBILITY bool +is_character_file(file_status __s) noexcept { + return __s.type() == file_type::character; +} + +inline _LIBCPP_INLINE_VISIBILITY bool is_character_file(const path& __p) { + return is_character_file(__status(__p)); +} + +inline _LIBCPP_INLINE_VISIBILITY bool +is_character_file(const path& __p, error_code& __ec) noexcept { + return is_character_file(__status(__p, &__ec)); +} + +inline _LIBCPP_INLINE_VISIBILITY bool is_directory(file_status __s) noexcept { + return __s.type() == file_type::directory; +} + +inline _LIBCPP_INLINE_VISIBILITY bool is_directory(const path& __p) { + return is_directory(__status(__p)); +} + +inline _LIBCPP_INLINE_VISIBILITY bool is_directory(const path& __p, + error_code& __ec) noexcept { + return is_directory(__status(__p, &__ec)); +} + +inline _LIBCPP_INLINE_VISIBILITY bool is_empty(const path& __p) { + return __fs_is_empty(__p); +} + +inline _LIBCPP_INLINE_VISIBILITY bool is_empty(const path& __p, + error_code& __ec) { + return __fs_is_empty(__p, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY bool is_fifo(file_status __s) noexcept { + return __s.type() == file_type::fifo; +} +inline _LIBCPP_INLINE_VISIBILITY bool is_fifo(const path& __p) { + return is_fifo(__status(__p)); +} + +inline _LIBCPP_INLINE_VISIBILITY bool is_fifo(const path& __p, + error_code& __ec) noexcept { + return is_fifo(__status(__p, &__ec)); +} + +inline _LIBCPP_INLINE_VISIBILITY bool +is_regular_file(file_status __s) noexcept { + return __s.type() == file_type::regular; +} + +inline _LIBCPP_INLINE_VISIBILITY bool is_regular_file(const path& __p) { + return is_regular_file(__status(__p)); +} + +inline _LIBCPP_INLINE_VISIBILITY bool +is_regular_file(const path& __p, error_code& __ec) noexcept { + return is_regular_file(__status(__p, &__ec)); +} + +inline _LIBCPP_INLINE_VISIBILITY bool is_socket(file_status __s) noexcept { + return __s.type() == file_type::socket; +} + +inline _LIBCPP_INLINE_VISIBILITY bool is_socket(const path& __p) { + return is_socket(__status(__p)); +} + +inline _LIBCPP_INLINE_VISIBILITY bool is_socket(const path& __p, + error_code& __ec) noexcept { + return is_socket(__status(__p, &__ec)); +} + +inline _LIBCPP_INLINE_VISIBILITY bool is_symlink(file_status __s) noexcept { + return __s.type() == file_type::symlink; +} + +inline _LIBCPP_INLINE_VISIBILITY bool is_symlink(const path& __p) { + return is_symlink(__symlink_status(__p)); +} + +inline _LIBCPP_INLINE_VISIBILITY bool is_symlink(const path& __p, + error_code& __ec) noexcept { + return is_symlink(__symlink_status(__p, &__ec)); +} + +inline _LIBCPP_INLINE_VISIBILITY bool is_other(file_status __s) noexcept { + return exists(__s) && !is_regular_file(__s) && !is_directory(__s) && + !is_symlink(__s); +} + +inline _LIBCPP_INLINE_VISIBILITY bool is_other(const path& __p) { + return is_other(__status(__p)); +} + +inline _LIBCPP_INLINE_VISIBILITY bool is_other(const path& __p, + error_code& __ec) noexcept { + return is_other(__status(__p, &__ec)); +} + +inline _LIBCPP_INLINE_VISIBILITY file_time_type +last_write_time(const path& __p) { + return __last_write_time(__p); +} + +inline _LIBCPP_INLINE_VISIBILITY file_time_type +last_write_time(const path& __p, error_code& __ec) noexcept { + return __last_write_time(__p, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY void last_write_time(const path& __p, + file_time_type __t) { + __last_write_time(__p, __t); +} + +inline _LIBCPP_INLINE_VISIBILITY void +last_write_time(const path& __p, file_time_type __t, + error_code& __ec) noexcept { + __last_write_time(__p, __t, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY void +permissions(const path& __p, perms __prms, + perm_options __opts = perm_options::replace) { + __permissions(__p, __prms, __opts); +} + +inline _LIBCPP_INLINE_VISIBILITY void permissions(const path& __p, perms __prms, + error_code& __ec) noexcept { + __permissions(__p, __prms, perm_options::replace, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY void permissions(const path& __p, perms __prms, + perm_options __opts, + error_code& __ec) { + __permissions(__p, __prms, __opts, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY path proximate(const path& __p, + const path& __base, + error_code& __ec) { + path __tmp = __weakly_canonical(__p, &__ec); + if (__ec) + return {}; + path __tmp_base = __weakly_canonical(__base, &__ec); + if (__ec) + return {}; + return __tmp.lexically_proximate(__tmp_base); +} + +inline _LIBCPP_INLINE_VISIBILITY path proximate(const path& __p, + error_code& __ec) { + return proximate(__p, current_path(), __ec); +} + +inline _LIBCPP_INLINE_VISIBILITY path +proximate(const path& __p, const path& __base = current_path()) { + return __weakly_canonical(__p).lexically_proximate( + __weakly_canonical(__base)); +} + +inline _LIBCPP_INLINE_VISIBILITY path read_symlink(const path& __p) { + return __read_symlink(__p); +} + +inline _LIBCPP_INLINE_VISIBILITY path read_symlink(const path& __p, + error_code& __ec) { + return __read_symlink(__p, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY path relative(const path& __p, + const path& __base, + error_code& __ec) { + path __tmp = __weakly_canonical(__p, &__ec); + if (__ec) + return path(); + path __tmpbase = __weakly_canonical(__base, &__ec); + if (__ec) + return path(); + return __tmp.lexically_relative(__tmpbase); +} + +inline _LIBCPP_INLINE_VISIBILITY path relative(const path& __p, + error_code& __ec) { + return relative(__p, current_path(), __ec); +} + +inline _LIBCPP_INLINE_VISIBILITY path +relative(const path& __p, const path& __base = current_path()) { + return __weakly_canonical(__p).lexically_relative(__weakly_canonical(__base)); +} + +inline _LIBCPP_INLINE_VISIBILITY bool remove(const path& __p) { + return __remove(__p); +} + +inline _LIBCPP_INLINE_VISIBILITY bool remove(const path& __p, + error_code& __ec) noexcept { + return __remove(__p, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY uintmax_t remove_all(const path& __p) { + return __remove_all(__p); +} + +inline _LIBCPP_INLINE_VISIBILITY uintmax_t remove_all(const path& __p, + error_code& __ec) { + return __remove_all(__p, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY void rename(const path& __from, + const path& __to) { + return __rename(__from, __to); +} + +inline _LIBCPP_INLINE_VISIBILITY void +rename(const path& __from, const path& __to, error_code& __ec) noexcept { + return __rename(__from, __to, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY void resize_file(const path& __p, + uintmax_t __ns) { + return __resize_file(__p, __ns); +} + +inline _LIBCPP_INLINE_VISIBILITY void +resize_file(const path& __p, uintmax_t __ns, error_code& __ec) noexcept { + return __resize_file(__p, __ns, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY space_info space(const path& __p) { + return __space(__p); +} + +inline _LIBCPP_INLINE_VISIBILITY space_info space(const path& __p, + error_code& __ec) noexcept { + return __space(__p, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY file_status status(const path& __p) { + return __status(__p); +} + +inline _LIBCPP_INLINE_VISIBILITY file_status status(const path& __p, + error_code& __ec) noexcept { + return __status(__p, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY file_status symlink_status(const path& __p) { + return __symlink_status(__p); +} + +inline _LIBCPP_INLINE_VISIBILITY file_status +symlink_status(const path& __p, error_code& __ec) noexcept { + return __symlink_status(__p, &__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY path temp_directory_path() { + return __temp_directory_path(); +} + +inline _LIBCPP_INLINE_VISIBILITY path temp_directory_path(error_code& __ec) { + return __temp_directory_path(&__ec); +} + +inline _LIBCPP_INLINE_VISIBILITY path weakly_canonical(path const& __p) { + return __weakly_canonical(__p); +} + +inline _LIBCPP_INLINE_VISIBILITY path weakly_canonical(path const& __p, + error_code& __ec) { + return __weakly_canonical(__p, &__ec); +} + +class directory_iterator; +class recursive_directory_iterator; +class __dir_stream; + +class directory_entry { + typedef _VSTD_FS::path _Path; + +public: + // constructors and destructors + directory_entry() noexcept = default; + directory_entry(directory_entry const&) = default; + directory_entry(directory_entry&&) noexcept = default; + + _LIBCPP_INLINE_VISIBILITY + explicit directory_entry(_Path const& __p) : __p_(__p) { + error_code __ec; + __refresh(&__ec); + } + + _LIBCPP_INLINE_VISIBILITY + directory_entry(_Path const& __p, error_code& __ec) : __p_(__p) { + __refresh(&__ec); + } + + ~directory_entry() {} + + directory_entry& operator=(directory_entry const&) = default; + directory_entry& operator=(directory_entry&&) noexcept = default; + + _LIBCPP_INLINE_VISIBILITY + void assign(_Path const& __p) { + __p_ = __p; + error_code __ec; + __refresh(&__ec); + } + + _LIBCPP_INLINE_VISIBILITY + void assign(_Path const& __p, error_code& __ec) { + __p_ = __p; + __refresh(&__ec); + } + + _LIBCPP_INLINE_VISIBILITY + void replace_filename(_Path const& __p) { + __p_.replace_filename(__p); + error_code __ec; + __refresh(&__ec); + } + + _LIBCPP_INLINE_VISIBILITY + void replace_filename(_Path const& __p, error_code& __ec) { + __p_ = __p_.parent_path() / __p; + __refresh(&__ec); + } + + _LIBCPP_INLINE_VISIBILITY + void refresh() { __refresh(); } + + _LIBCPP_INLINE_VISIBILITY + void refresh(error_code& __ec) noexcept { __refresh(&__ec); } + + _LIBCPP_INLINE_VISIBILITY + _Path const& path() const noexcept { return __p_; } + + _LIBCPP_INLINE_VISIBILITY + operator const _Path&() const noexcept { return __p_; } + + _LIBCPP_INLINE_VISIBILITY + bool exists() const { return _VSTD_FS::exists(file_status{__get_ft()}); } + + _LIBCPP_INLINE_VISIBILITY + bool exists(error_code& __ec) const noexcept { + return _VSTD_FS::exists(file_status{__get_ft(&__ec)}); + } + + _LIBCPP_INLINE_VISIBILITY + bool is_block_file() const { return __get_ft() == file_type::block; } + + _LIBCPP_INLINE_VISIBILITY + bool is_block_file(error_code& __ec) const noexcept { + return __get_ft(&__ec) == file_type::block; + } + + _LIBCPP_INLINE_VISIBILITY + bool is_character_file() const { return __get_ft() == file_type::character; } + + _LIBCPP_INLINE_VISIBILITY + bool is_character_file(error_code& __ec) const noexcept { + return __get_ft(&__ec) == file_type::character; + } + + _LIBCPP_INLINE_VISIBILITY + bool is_directory() const { return __get_ft() == file_type::directory; } + + _LIBCPP_INLINE_VISIBILITY + bool is_directory(error_code& __ec) const noexcept { + return __get_ft(&__ec) == file_type::directory; + } + + _LIBCPP_INLINE_VISIBILITY + bool is_fifo() const { return __get_ft() == file_type::fifo; } + + _LIBCPP_INLINE_VISIBILITY + bool is_fifo(error_code& __ec) const noexcept { + return __get_ft(&__ec) == file_type::fifo; + } + + _LIBCPP_INLINE_VISIBILITY + bool is_other() const { return _VSTD_FS::is_other(file_status{__get_ft()}); } + + _LIBCPP_INLINE_VISIBILITY + bool is_other(error_code& __ec) const noexcept { + return _VSTD_FS::is_other(file_status{__get_ft(&__ec)}); + } + + _LIBCPP_INLINE_VISIBILITY + bool is_regular_file() const { return __get_ft() == file_type::regular; } + + _LIBCPP_INLINE_VISIBILITY + bool is_regular_file(error_code& __ec) const noexcept { + return __get_ft(&__ec) == file_type::regular; + } + + _LIBCPP_INLINE_VISIBILITY + bool is_socket() const { return __get_ft() == file_type::socket; } + + _LIBCPP_INLINE_VISIBILITY + bool is_socket(error_code& __ec) const noexcept { + return __get_ft(&__ec) == file_type::socket; + } + + _LIBCPP_INLINE_VISIBILITY + bool is_symlink() const { return __get_sym_ft() == file_type::symlink; } + + _LIBCPP_INLINE_VISIBILITY + bool is_symlink(error_code& __ec) const noexcept { + return __get_sym_ft(&__ec) == file_type::symlink; + } + _LIBCPP_INLINE_VISIBILITY + uintmax_t file_size() const { return __get_size(); } + + _LIBCPP_INLINE_VISIBILITY + uintmax_t file_size(error_code& __ec) const noexcept { + return __get_size(&__ec); + } + + _LIBCPP_INLINE_VISIBILITY + uintmax_t hard_link_count() const { return __get_nlink(); } + + _LIBCPP_INLINE_VISIBILITY + uintmax_t hard_link_count(error_code& __ec) const noexcept { + return __get_nlink(&__ec); + } + + _LIBCPP_INLINE_VISIBILITY + file_time_type last_write_time() const { return __get_write_time(); } + + _LIBCPP_INLINE_VISIBILITY + file_time_type last_write_time(error_code& __ec) const noexcept { + return __get_write_time(&__ec); + } + + _LIBCPP_INLINE_VISIBILITY + file_status status() const { return __get_status(); } + + _LIBCPP_INLINE_VISIBILITY + file_status status(error_code& __ec) const noexcept { + return __get_status(&__ec); + } + + _LIBCPP_INLINE_VISIBILITY + file_status symlink_status() const { return __get_symlink_status(); } + + _LIBCPP_INLINE_VISIBILITY + file_status symlink_status(error_code& __ec) const noexcept { + return __get_symlink_status(&__ec); + } + + _LIBCPP_INLINE_VISIBILITY + bool operator<(directory_entry const& __rhs) const noexcept { + return __p_ < __rhs.__p_; + } + + _LIBCPP_INLINE_VISIBILITY + bool operator==(directory_entry const& __rhs) const noexcept { + return __p_ == __rhs.__p_; + } + + _LIBCPP_INLINE_VISIBILITY + bool operator!=(directory_entry const& __rhs) const noexcept { + return __p_ != __rhs.__p_; + } + + _LIBCPP_INLINE_VISIBILITY + bool operator<=(directory_entry const& __rhs) const noexcept { + return __p_ <= __rhs.__p_; + } + + _LIBCPP_INLINE_VISIBILITY + bool operator>(directory_entry const& __rhs) const noexcept { + return __p_ > __rhs.__p_; + } + + _LIBCPP_INLINE_VISIBILITY + bool operator>=(directory_entry const& __rhs) const noexcept { + return __p_ >= __rhs.__p_; + } + +private: + friend class directory_iterator; + friend class recursive_directory_iterator; + friend class __dir_stream; + + enum _CacheType : unsigned char { + _Empty, + _IterSymlink, + _IterNonSymlink, + _RefreshSymlink, + _RefreshSymlinkUnresolved, + _RefreshNonSymlink + }; + + struct __cached_data { + uintmax_t __size_; + uintmax_t __nlink_; + file_time_type __write_time_; + perms __sym_perms_; + perms __non_sym_perms_; + file_type __type_; + _CacheType __cache_type_; + + _LIBCPP_INLINE_VISIBILITY + __cached_data() noexcept { __reset(); } + + _LIBCPP_INLINE_VISIBILITY + void __reset() { + __cache_type_ = _Empty; + __type_ = file_type::none; + __sym_perms_ = __non_sym_perms_ = perms::unknown; + __size_ = __nlink_ = uintmax_t(-1); + __write_time_ = file_time_type::min(); + } + }; + + _LIBCPP_INLINE_VISIBILITY + static __cached_data __create_iter_result(file_type __ft) { + __cached_data __data; + __data.__type_ = __ft; + __data.__cache_type_ = [&]() { + switch (__ft) { + case file_type::none: + return _Empty; + case file_type::symlink: + return _IterSymlink; + default: + return _IterNonSymlink; + } + }(); + return __data; + } + + _LIBCPP_INLINE_VISIBILITY + void __assign_iter_entry(_Path&& __p, __cached_data __dt) { + __p_ = std::move(__p); + __data_ = __dt; + } + + _LIBCPP_FUNC_VIS + error_code __do_refresh() noexcept; + + _LIBCPP_INLINE_VISIBILITY + static bool __is_dne_error(error_code const& __ec) { + if (!__ec) + return true; + switch (static_cast(__ec.value())) { + case errc::no_such_file_or_directory: + case errc::not_a_directory: + return true; + default: + return false; + } + } + + _LIBCPP_INLINE_VISIBILITY + void __handle_error(const char* __msg, error_code* __dest_ec, + error_code const& __ec, bool __allow_dne = false) const { + if (__dest_ec) { + *__dest_ec = __ec; + return; + } + if (__ec && (!__allow_dne || !__is_dne_error(__ec))) + __throw_filesystem_error(__msg, __p_, __ec); + } + + _LIBCPP_INLINE_VISIBILITY + void __refresh(error_code* __ec = nullptr) { + __handle_error("in directory_entry::refresh", __ec, __do_refresh(), + /*allow_dne*/ true); + } + + _LIBCPP_INLINE_VISIBILITY + file_type __get_sym_ft(error_code* __ec = nullptr) const { + switch (__data_.__cache_type_) { + case _Empty: + return __symlink_status(__p_, __ec).type(); + case _IterSymlink: + case _RefreshSymlink: + case _RefreshSymlinkUnresolved: + if (__ec) + __ec->clear(); + return file_type::symlink; + case _IterNonSymlink: + case _RefreshNonSymlink: + file_status __st(__data_.__type_); + if (__ec && !_VSTD_FS::exists(__st)) + *__ec = make_error_code(errc::no_such_file_or_directory); + else if (__ec) + __ec->clear(); + return __data_.__type_; + } + _LIBCPP_UNREACHABLE(); + } + + _LIBCPP_INLINE_VISIBILITY + file_type __get_ft(error_code* __ec = nullptr) const { + switch (__data_.__cache_type_) { + case _Empty: + case _IterSymlink: + case _RefreshSymlinkUnresolved: + return __status(__p_, __ec).type(); + case _IterNonSymlink: + case _RefreshNonSymlink: + case _RefreshSymlink: { + file_status __st(__data_.__type_); + if (__ec && !_VSTD_FS::exists(__st)) + *__ec = make_error_code(errc::no_such_file_or_directory); + else if (__ec) + __ec->clear(); + return __data_.__type_; + } + } + _LIBCPP_UNREACHABLE(); + } + + _LIBCPP_INLINE_VISIBILITY + file_status __get_status(error_code* __ec = nullptr) const { + switch (__data_.__cache_type_) { + case _Empty: + case _IterNonSymlink: + case _IterSymlink: + case _RefreshSymlinkUnresolved: + return __status(__p_, __ec); + case _RefreshNonSymlink: + case _RefreshSymlink: + return file_status(__get_ft(__ec), __data_.__non_sym_perms_); + } + _LIBCPP_UNREACHABLE(); + } + + _LIBCPP_INLINE_VISIBILITY + file_status __get_symlink_status(error_code* __ec = nullptr) const { + switch (__data_.__cache_type_) { + case _Empty: + case _IterNonSymlink: + case _IterSymlink: + return __symlink_status(__p_, __ec); + case _RefreshNonSymlink: + return file_status(__get_sym_ft(__ec), __data_.__non_sym_perms_); + case _RefreshSymlink: + case _RefreshSymlinkUnresolved: + return file_status(__get_sym_ft(__ec), __data_.__sym_perms_); + } + _LIBCPP_UNREACHABLE(); + } + + _LIBCPP_INLINE_VISIBILITY + uintmax_t __get_size(error_code* __ec = nullptr) const { + switch (__data_.__cache_type_) { + case _Empty: + case _IterNonSymlink: + case _IterSymlink: + case _RefreshSymlinkUnresolved: + return _VSTD_FS::__file_size(__p_, __ec); + case _RefreshSymlink: + case _RefreshNonSymlink: { + error_code __m_ec; + file_status __st(__get_ft(&__m_ec)); + __handle_error("in directory_entry::file_size", __ec, __m_ec); + if (_VSTD_FS::exists(__st) && !_VSTD_FS::is_regular_file(__st)) { + errc __err_kind = _VSTD_FS::is_directory(__st) ? errc::is_a_directory + : errc::not_supported; + __handle_error("in directory_entry::file_size", __ec, + make_error_code(__err_kind)); + } + return __data_.__size_; + } + } + _LIBCPP_UNREACHABLE(); + } + + _LIBCPP_INLINE_VISIBILITY + uintmax_t __get_nlink(error_code* __ec = nullptr) const { + switch (__data_.__cache_type_) { + case _Empty: + case _IterNonSymlink: + case _IterSymlink: + case _RefreshSymlinkUnresolved: + return _VSTD_FS::__hard_link_count(__p_, __ec); + case _RefreshSymlink: + case _RefreshNonSymlink: { + error_code __m_ec; + (void)__get_ft(&__m_ec); + __handle_error("in directory_entry::hard_link_count", __ec, __m_ec); + return __data_.__nlink_; + } + } + _LIBCPP_UNREACHABLE(); + } + + _LIBCPP_INLINE_VISIBILITY + file_time_type __get_write_time(error_code* __ec = nullptr) const { + switch (__data_.__cache_type_) { + case _Empty: + case _IterNonSymlink: + case _IterSymlink: + case _RefreshSymlinkUnresolved: + return _VSTD_FS::__last_write_time(__p_, __ec); + case _RefreshSymlink: + case _RefreshNonSymlink: { + error_code __m_ec; + file_status __st(__get_ft(&__m_ec)); + __handle_error("in directory_entry::last_write_time", __ec, __m_ec); + if (_VSTD_FS::exists(__st) && + __data_.__write_time_ == file_time_type::min()) + __handle_error("in directory_entry::last_write_time", __ec, + make_error_code(errc::value_too_large)); + return __data_.__write_time_; + } + } + _LIBCPP_UNREACHABLE(); + } + +private: + _Path __p_; + __cached_data __data_; +}; + +class __dir_element_proxy { +public: + inline _LIBCPP_INLINE_VISIBILITY directory_entry operator*() { + return _VSTD::move(__elem_); + } + +private: + friend class directory_iterator; + friend class recursive_directory_iterator; + explicit __dir_element_proxy(directory_entry const& __e) : __elem_(__e) {} + __dir_element_proxy(__dir_element_proxy&& __o) + : __elem_(_VSTD::move(__o.__elem_)) {} + directory_entry __elem_; +}; + +class directory_iterator { +public: + typedef directory_entry value_type; + typedef ptrdiff_t difference_type; + typedef value_type const* pointer; + typedef value_type const& reference; + typedef input_iterator_tag iterator_category; + +public: + //ctor & dtor + directory_iterator() noexcept {} + + explicit directory_iterator(const path& __p) + : directory_iterator(__p, nullptr) {} + + directory_iterator(const path& __p, directory_options __opts) + : directory_iterator(__p, nullptr, __opts) {} + + directory_iterator(const path& __p, error_code& __ec) + : directory_iterator(__p, &__ec) {} + + directory_iterator(const path& __p, directory_options __opts, + error_code& __ec) + : directory_iterator(__p, &__ec, __opts) {} + + directory_iterator(const directory_iterator&) = default; + directory_iterator(directory_iterator&&) = default; + directory_iterator& operator=(const directory_iterator&) = default; + + directory_iterator& operator=(directory_iterator&& __o) noexcept { + // non-default implementation provided to support self-move assign. + if (this != &__o) { + __imp_ = _VSTD::move(__o.__imp_); + } + return *this; + } + + ~directory_iterator() = default; + + const directory_entry& operator*() const { + _LIBCPP_ASSERT(__imp_, "The end iterator cannot be dereferenced"); + return __dereference(); + } + + const directory_entry* operator->() const { return &**this; } + + directory_iterator& operator++() { return __increment(); } + + __dir_element_proxy operator++(int) { + __dir_element_proxy __p(**this); + __increment(); + return __p; + } + + directory_iterator& increment(error_code& __ec) { return __increment(&__ec); } + +private: + inline _LIBCPP_INLINE_VISIBILITY friend bool + operator==(const directory_iterator& __lhs, + const directory_iterator& __rhs) noexcept; + + // construct the dir_stream + _LIBCPP_FUNC_VIS + directory_iterator(const path&, error_code*, + directory_options = directory_options::none); + + _LIBCPP_FUNC_VIS + directory_iterator& __increment(error_code* __ec = nullptr); + + _LIBCPP_FUNC_VIS + const directory_entry& __dereference() const; + +private: + shared_ptr<__dir_stream> __imp_; +}; + +inline _LIBCPP_INLINE_VISIBILITY bool +operator==(const directory_iterator& __lhs, + const directory_iterator& __rhs) noexcept { + return __lhs.__imp_ == __rhs.__imp_; +} + +inline _LIBCPP_INLINE_VISIBILITY bool +operator!=(const directory_iterator& __lhs, + const directory_iterator& __rhs) noexcept { + return !(__lhs == __rhs); +} + +// enable directory_iterator range-based for statements +inline _LIBCPP_INLINE_VISIBILITY directory_iterator +begin(directory_iterator __iter) noexcept { + return __iter; +} + +inline _LIBCPP_INLINE_VISIBILITY directory_iterator +end(const directory_iterator&) noexcept { + return directory_iterator(); +} + +class recursive_directory_iterator { +public: + using value_type = directory_entry; + using difference_type = std::ptrdiff_t; + using pointer = directory_entry const*; + using reference = directory_entry const&; + using iterator_category = std::input_iterator_tag; + +public: + // constructors and destructor + _LIBCPP_INLINE_VISIBILITY + recursive_directory_iterator() noexcept : __rec_(false) {} + + _LIBCPP_INLINE_VISIBILITY + explicit recursive_directory_iterator( + const path& __p, directory_options __xoptions = directory_options::none) + : recursive_directory_iterator(__p, __xoptions, nullptr) {} + + _LIBCPP_INLINE_VISIBILITY + recursive_directory_iterator(const path& __p, directory_options __xoptions, + error_code& __ec) + : recursive_directory_iterator(__p, __xoptions, &__ec) {} + + _LIBCPP_INLINE_VISIBILITY + recursive_directory_iterator(const path& __p, error_code& __ec) + : recursive_directory_iterator(__p, directory_options::none, &__ec) {} + + recursive_directory_iterator(const recursive_directory_iterator&) = default; + recursive_directory_iterator(recursive_directory_iterator&&) = default; + + recursive_directory_iterator& + operator=(const recursive_directory_iterator&) = default; + + _LIBCPP_INLINE_VISIBILITY + recursive_directory_iterator& + operator=(recursive_directory_iterator&& __o) noexcept { + // non-default implementation provided to support self-move assign. + if (this != &__o) { + __imp_ = _VSTD::move(__o.__imp_); + __rec_ = __o.__rec_; + } + return *this; + } + + ~recursive_directory_iterator() = default; + + _LIBCPP_INLINE_VISIBILITY + const directory_entry& operator*() const { return __dereference(); } + + _LIBCPP_INLINE_VISIBILITY + const directory_entry* operator->() const { return &__dereference(); } + + recursive_directory_iterator& operator++() { return __increment(); } + + _LIBCPP_INLINE_VISIBILITY + __dir_element_proxy operator++(int) { + __dir_element_proxy __p(**this); + __increment(); + return __p; + } + + _LIBCPP_INLINE_VISIBILITY + recursive_directory_iterator& increment(error_code& __ec) { + return __increment(&__ec); + } + + _LIBCPP_FUNC_VIS directory_options options() const; + _LIBCPP_FUNC_VIS int depth() const; + + _LIBCPP_INLINE_VISIBILITY + void pop() { __pop(); } + + _LIBCPP_INLINE_VISIBILITY + void pop(error_code& __ec) { __pop(&__ec); } + + _LIBCPP_INLINE_VISIBILITY + bool recursion_pending() const { return __rec_; } + + _LIBCPP_INLINE_VISIBILITY + void disable_recursion_pending() { __rec_ = false; } + +private: + recursive_directory_iterator(const path& __p, directory_options __opt, + error_code* __ec); + + _LIBCPP_FUNC_VIS + const directory_entry& __dereference() const; + + _LIBCPP_FUNC_VIS + bool __try_recursion(error_code* __ec); + + _LIBCPP_FUNC_VIS + void __advance(error_code* __ec = nullptr); + + _LIBCPP_FUNC_VIS + recursive_directory_iterator& __increment(error_code* __ec = nullptr); + + _LIBCPP_FUNC_VIS + void __pop(error_code* __ec = nullptr); + + inline _LIBCPP_INLINE_VISIBILITY friend bool + operator==(const recursive_directory_iterator&, + const recursive_directory_iterator&) noexcept; + + struct __shared_imp; + shared_ptr<__shared_imp> __imp_; + bool __rec_; +}; // class recursive_directory_iterator + +inline _LIBCPP_INLINE_VISIBILITY bool +operator==(const recursive_directory_iterator& __lhs, + const recursive_directory_iterator& __rhs) noexcept { + return __lhs.__imp_ == __rhs.__imp_; +} + +_LIBCPP_INLINE_VISIBILITY +inline bool operator!=(const recursive_directory_iterator& __lhs, + const recursive_directory_iterator& __rhs) noexcept { + return !(__lhs == __rhs); +} +// enable recursive_directory_iterator range-based for statements +inline _LIBCPP_INLINE_VISIBILITY recursive_directory_iterator +begin(recursive_directory_iterator __iter) noexcept { + return __iter; +} + +inline _LIBCPP_INLINE_VISIBILITY recursive_directory_iterator +end(const recursive_directory_iterator&) noexcept { + return recursive_directory_iterator(); +} + +_LIBCPP_END_NAMESPACE_FILESYSTEM + +#endif // !_LIBCPP_CXX03_LANG + +_LIBCPP_POP_MACROS + +#endif // _LIBCPP_FILESYSTEM diff --git a/include/fstream b/include/fstream index 8b9aefaac..332b4747c 100644 --- a/include/fstream +++ b/include/fstream @@ -38,6 +38,7 @@ public: bool is_open() const; basic_filebuf* open(const char* s, ios_base::openmode mode); basic_filebuf* open(const string& s, ios_base::openmode mode); + basic_filebuf* open(const filesystem::path& p, ios_base::openmode mode); // C++17 basic_filebuf* close(); protected: @@ -77,6 +78,8 @@ public: basic_ifstream(); explicit basic_ifstream(const char* s, ios_base::openmode mode = ios_base::in); explicit basic_ifstream(const string& s, ios_base::openmode mode = ios_base::in); + explicit basic_ifstream(const filesystem::path& p, + ios_base::openmode mode = ios_base::in); // C++17 basic_ifstream(basic_ifstream&& rhs); basic_ifstream& operator=(basic_ifstream&& rhs); @@ -86,6 +89,8 @@ public: bool is_open() const; void open(const char* s, ios_base::openmode mode = ios_base::in); void open(const string& s, ios_base::openmode mode = ios_base::in); + void open(const filesystem::path& s, ios_base::openmode mode = ios_base::in); // C++17 + void close(); }; @@ -110,6 +115,8 @@ public: basic_ofstream(); explicit basic_ofstream(const char* s, ios_base::openmode mode = ios_base::out); explicit basic_ofstream(const string& s, ios_base::openmode mode = ios_base::out); + explicit basic_ofstream(const filesystem::path& p, + ios_base::openmode mode = ios_base::out); // C++17 basic_ofstream(basic_ofstream&& rhs); basic_ofstream& operator=(basic_ofstream&& rhs); @@ -119,6 +126,9 @@ public: bool is_open() const; void open(const char* s, ios_base::openmode mode = ios_base::out); void open(const string& s, ios_base::openmode mode = ios_base::out); + void open(const filesystem::path& p, + ios_base::openmode mode = ios_base::out); // C++17 + void close(); }; @@ -143,6 +153,8 @@ public: basic_fstream(); explicit basic_fstream(const char* s, ios_base::openmode mode = ios_base::in|ios_base::out); explicit basic_fstream(const string& s, ios_base::openmode mode = ios_base::in|ios_base::out); + explicit basic_fstream(const filesystem::path& p, + ios_base::openmode mode = ios_base::in|ios_base::out); C++17 basic_fstream(basic_fstream&& rhs); basic_fstream& operator=(basic_fstream&& rhs); @@ -152,6 +164,9 @@ public: bool is_open() const; void open(const char* s, ios_base::openmode mode = ios_base::in|ios_base::out); void open(const string& s, ios_base::openmode mode = ios_base::in|ios_base::out); + void open(const filesystem::path& s, + ios_base::openmode mode = ios_base::in|ios_base::out); // C++17 + void close(); }; @@ -171,6 +186,7 @@ typedef basic_fstream wfstream; #include <__locale> #include #include +#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -219,6 +235,12 @@ public: _LIBCPP_INLINE_VISIBILITY basic_filebuf* open(const string& __s, ios_base::openmode __mode); +#if _LIBCPP_STD_VER >= 17 + _LIBCPP_INLINE_VISIBILITY + basic_filebuf* open(const _VSTD_FS::path& __p, ios_base::openmode __mode) { + return open(__p.c_str(), __mode); + } +#endif _LIBCPP_INLINE_VISIBILITY basic_filebuf* __open(int __fd, ios_base::openmode __mode); #endif @@ -1128,6 +1150,11 @@ public: #endif _LIBCPP_INLINE_VISIBILITY explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in); +#if _LIBCPP_STD_VER >= 17 + _LIBCPP_INLINE_VISIBILITY + explicit basic_ifstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in) + : basic_ifstream(__p.c_str(), __mode) {} +#endif // _LIBCPP_STD_VER >= 17 #endif #ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY @@ -1149,6 +1176,13 @@ public: void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::in); #endif void open(const string& __s, ios_base::openmode __mode = ios_base::in); +#if _LIBCPP_STD_VER >= 17 + _LIBCPP_INLINE_VISIBILITY + void open(const filesystem::path& __p, + ios_base::openmode __mode = ios_base::in) { + return open(__p.c_str(), __mode); + } +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_INLINE_VISIBILITY void __open(int __fd, ios_base::openmode __mode); @@ -1329,6 +1363,13 @@ public: #endif _LIBCPP_INLINE_VISIBILITY explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out); + +#if _LIBCPP_STD_VER >= 17 + _LIBCPP_INLINE_VISIBILITY + explicit basic_ofstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out) + : basic_ofstream(__p.c_str(), __mode) {} +#endif // _LIBCPP_STD_VER >= 17 + #ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_ofstream(basic_ofstream&& __rhs); @@ -1350,6 +1391,12 @@ public: #endif void open(const string& __s, ios_base::openmode __mode = ios_base::out); +#if _LIBCPP_STD_VER >= 17 + _LIBCPP_INLINE_VISIBILITY + void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out) + { return open(__p.c_str(), __mode); } +#endif // _LIBCPP_STD_VER >= 17 + _LIBCPP_INLINE_VISIBILITY void __open(int __fd, ios_base::openmode __mode); #endif @@ -1530,6 +1577,13 @@ public: #endif _LIBCPP_INLINE_VISIBILITY explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out); + +#if _LIBCPP_STD_VER >= 17 + _LIBCPP_INLINE_VISIBILITY + explicit basic_fstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in | ios_base::out) + : basic_fstream(__p.c_str(), __mode) {} +#endif // _LIBCPP_STD_VER >= 17 + #endif #ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY @@ -1551,6 +1605,13 @@ public: void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::in | ios_base::out); #endif void open(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out); + +#if _LIBCPP_STD_VER >= 17 + _LIBCPP_INLINE_VISIBILITY + void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in|ios_base::out) + { return open(__p.c_str(), __mode); } +#endif // _LIBCPP_STD_VER >= 17 + #endif _LIBCPP_INLINE_VISIBILITY void close(); diff --git a/include/module.modulemap b/include/module.modulemap index e17c3a2f6..127a42b06 100644 --- a/include/module.modulemap +++ b/include/module.modulemap @@ -264,6 +264,10 @@ module std [system] { header "exception" export * } + module filesystem { + header "filesystem" + export * + } module forward_list { header "forward_list" export initializer_list diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 5cdf1b868..a40d217dc 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -291,12 +291,43 @@ endif() # Add a meta-target for both libraries. add_custom_target(cxx DEPENDS cxx-headers ${LIBCXX_BUILD_TARGETS}) + +if (LIBCXX_ENABLE_FILESYSTEM) + set(LIBCXX_FILESYSTEM_SOURCES + ../src/filesystem/operations.cpp + ../src/filesystem/directory_iterator.cpp) + + # Filesystem uses __int128_t, which requires a definition of __muloi4 when + # compiled with UBSAN. This definition is not provided by libgcc_s, but is + # provided by compiler-rt. So we need to disable it to avoid having multiple + # definitions. See filesystem/int128_builtins.cpp. + if (NOT LIBCXX_USE_COMPILER_RT) + list(APPEND LIBCXX_FILESYSTEM_SOURCES ../src/filesystem/int128_builtins.cpp) + endif() + + add_library(cxx_filesystem STATIC ${LIBCXX_FILESYSTEM_SOURCES}) + if (LIBCXX_ENABLE_SHARED) + target_link_libraries(cxx_filesystem cxx_shared) + else() + target_link_libraries(cxx_filesystem cxx_static) + endif() + + set(filesystem_flags "${LIBCXX_COMPILE_FLAGS}") + check_flag_supported(-std=c++14) + if (NOT MSVC AND LIBCXX_SUPPORTS_STD_EQ_CXX14_FLAG) + string(REPLACE "-std=c++11" "-std=c++14" filesystem_flags "${LIBCXX_COMPILE_FLAGS}") + endif() + set_target_properties(cxx_filesystem + PROPERTIES + COMPILE_FLAGS "${filesystem_flags}" + OUTPUT_NAME "c++fs" + ) +endif() + + if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY) file(GLOB LIBCXX_EXPERIMENTAL_SOURCES ../src/experimental/*.cpp) - if (LIBCXX_ENABLE_FILESYSTEM) - file(GLOB LIBCXX_FILESYSTEM_SOURCES ../src/experimental/filesystem/*.cpp) - endif() - add_library(cxx_experimental STATIC ${LIBCXX_EXPERIMENTAL_SOURCES} ${LIBCXX_FILESYSTEM_SOURCES}) + add_library(cxx_experimental STATIC ${LIBCXX_EXPERIMENTAL_SOURCES}) if (LIBCXX_ENABLE_SHARED) target_link_libraries(cxx_experimental cxx_shared) else() @@ -315,6 +346,7 @@ if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY) ) endif() + if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY) file(GLOB LIBCXX_EXTERNAL_THREADING_SUPPORT_SOURCES ../test/support/external_threads.cpp) @@ -362,10 +394,13 @@ if (LIBCXX_ENABLE_SHARED AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT) endif() if (LIBCXX_INSTALL_LIBRARY) + if (LIBCXX_INSTALL_FILESYSTEM_LIBRARY) + set(filesystem_lib cxx_filesystem) + endif() if (LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY) set(experimental_lib cxx_experimental) endif() - install(TARGETS ${LIBCXX_INSTALL_TARGETS} ${experimental_lib} + install(TARGETS ${LIBCXX_INSTALL_TARGETS} ${filesystem_lib} ${experimental_lib} LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx ) @@ -385,6 +420,9 @@ if (NOT CMAKE_CONFIGURATION_TYPES AND (LIBCXX_INSTALL_LIBRARY OR if(LIBCXX_INSTALL_LIBRARY) set(lib_install_target cxx) endif() + if (LIBCXX_INSTALL_FILESYSTEM_LIBRARY) + set(filesystem_lib_install_target cxx_filesystem) + endif() if (LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY) set(experimental_lib_install_target cxx_experimental) endif() @@ -394,6 +432,7 @@ if (NOT CMAKE_CONFIGURATION_TYPES AND (LIBCXX_INSTALL_LIBRARY OR add_custom_target(install-cxx DEPENDS ${lib_install_target} ${experimental_lib_install_target} + ${filesystem_lib_install_target} ${header_install_target} COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=cxx @@ -401,6 +440,7 @@ if (NOT CMAKE_CONFIGURATION_TYPES AND (LIBCXX_INSTALL_LIBRARY OR add_custom_target(install-cxx-stripped DEPENDS ${lib_install_target} ${experimental_lib_install_target} + ${filesystem_lib_install_target} ${header_install_target} COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=cxx diff --git a/src/experimental/filesystem/directory_iterator.cpp b/src/filesystem/directory_iterator.cpp similarity index 55% rename from src/experimental/filesystem/directory_iterator.cpp rename to src/filesystem/directory_iterator.cpp index 7a1ab2573..f0d807a03 100644 --- a/src/experimental/filesystem/directory_iterator.cpp +++ b/src/filesystem/directory_iterator.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -#include "experimental/filesystem" +#include "filesystem" #include "__config" #if defined(_LIBCPP_WIN32API) #define WIN32_LEAN_AND_MEAN @@ -19,14 +19,14 @@ #include "filesystem_common.h" -_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FILESYSTEM +_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM namespace detail { namespace { #if !defined(_LIBCPP_WIN32API) template -static file_type get_file_type(DirEntT *ent, int) { +static file_type get_file_type(DirEntT* ent, int) { switch (ent->d_type) { case DT_BLK: return file_type::block; @@ -52,22 +52,22 @@ static file_type get_file_type(DirEntT *ent, int) { } template -static file_type get_file_type(DirEntT *ent, long) { +static file_type get_file_type(DirEntT* ent, long) { return file_type::none; } -static pair -posix_readdir(DIR *dir_stream, error_code& ec) { - struct dirent* dir_entry_ptr = nullptr; - errno = 0; // zero errno in order to detect errors - ec.clear(); - if ((dir_entry_ptr = ::readdir(dir_stream)) == nullptr) { - if (errno) - ec = capture_errno(); - return {}; - } else { - return {dir_entry_ptr->d_name, get_file_type(dir_entry_ptr, 0)}; - } +static pair posix_readdir(DIR* dir_stream, + error_code& ec) { + struct dirent* dir_entry_ptr = nullptr; + errno = 0; // zero errno in order to detect errors + ec.clear(); + if ((dir_entry_ptr = ::readdir(dir_stream)) == nullptr) { + if (errno) + ec = capture_errno(); + return {}; + } else { + return {dir_entry_ptr->d_name, get_file_type(dir_entry_ptr, 0)}; + } } #else @@ -77,7 +77,7 @@ static file_type get_file_type(const WIN32_FIND_DATA& data) { return file_type::unknown; } static uintmax_t get_file_size(const WIN32_FIND_DATA& data) { - return (data.nFileSizeHight * (MAXDWORD+1)) + data.nFileSizeLow; + return (data.nFileSizeHight * (MAXDWORD + 1)) + data.nFileSizeLow; } static file_time_type get_write_time(const WIN32_FIND_DATA& data) { ULARGE_INTEGER tmp; @@ -97,19 +97,18 @@ using detail::ErrorHandler; #if defined(_LIBCPP_WIN32API) class __dir_stream { public: - __dir_stream() = delete; __dir_stream& operator=(const __dir_stream&) = delete; - __dir_stream(__dir_stream&& __ds) noexcept - : __stream_(__ds.__stream_), __root_(move(__ds.__root_)), - __entry_(move(__ds.__entry_)) { + __dir_stream(__dir_stream&& __ds) noexcept : __stream_(__ds.__stream_), + __root_(move(__ds.__root_)), + __entry_(move(__ds.__entry_)) { __ds.__stream_ = INVALID_HANDLE_VALUE; } __dir_stream(const path& root, directory_options opts, error_code& ec) : __stream_(INVALID_HANDLE_VALUE), __root_(root) { - __stream_ = ::FindFirstFileEx(root.c_str(), &__data_); + __stream_ = ::FindFirstFileEx(root.c_str(), &__data_); if (__stream_ == INVALID_HANDLE_VALUE) { ec = error_code(::GetLastError(), generic_category()); const bool ignore_permission_denied = @@ -166,75 +165,74 @@ public: #else class __dir_stream { public: - __dir_stream() = delete; - __dir_stream& operator=(const __dir_stream&) = delete; + __dir_stream() = delete; + __dir_stream& operator=(const __dir_stream&) = delete; - __dir_stream(__dir_stream&& other) noexcept - : __stream_(other.__stream_), __root_(move(other.__root_)), - __entry_(move(other.__entry_)) - { - other.__stream_ = nullptr; + __dir_stream(__dir_stream&& other) noexcept : __stream_(other.__stream_), + __root_(move(other.__root_)), + __entry_(move(other.__entry_)) { + other.__stream_ = nullptr; + } + + __dir_stream(const path& root, directory_options opts, error_code& ec) + : __stream_(nullptr), __root_(root) { + if ((__stream_ = ::opendir(root.c_str())) == nullptr) { + ec = detail::capture_errno(); + const bool allow_eacess = + bool(opts & directory_options::skip_permission_denied); + if (allow_eacess && ec.value() == EACCES) + ec.clear(); + return; } + advance(ec); + } + ~__dir_stream() noexcept { + if (__stream_) + close(); + } - __dir_stream(const path& root, directory_options opts, error_code& ec) - : __stream_(nullptr), - __root_(root) - { - if ((__stream_ = ::opendir(root.c_str())) == nullptr) { - ec = detail::capture_errno(); - const bool allow_eacess = - bool(opts & directory_options::skip_permission_denied); - if (allow_eacess && ec.value() == EACCES) - ec.clear(); - return; - } - advance(ec); + bool good() const noexcept { return __stream_ != nullptr; } + + bool advance(error_code& ec) { + while (true) { + auto str_type_pair = detail::posix_readdir(__stream_, ec); + auto& str = str_type_pair.first; + if (str == "." || str == "..") { + continue; + } else if (ec || str.empty()) { + close(); + return false; + } else { + __entry_.__assign_iter_entry( + __root_ / str, + directory_entry::__create_iter_result(str_type_pair.second)); + return true; + } } + } - ~__dir_stream() noexcept - { if (__stream_) close(); } - - bool good() const noexcept { return __stream_ != nullptr; } - - bool advance(error_code &ec) { - while (true) { - auto str_type_pair = detail::posix_readdir(__stream_, ec); - auto& str = str_type_pair.first; - if (str == "." || str == "..") { - continue; - } else if (ec || str.empty()) { - close(); - return false; - } else { - __entry_.__assign_iter_entry( - __root_ / str, - directory_entry::__create_iter_result(str_type_pair.second)); - return true; - } - } - } private: - error_code close() noexcept { - error_code m_ec; - if (::closedir(__stream_) == -1) - m_ec = detail::capture_errno(); - __stream_ = nullptr; - return m_ec; - } + error_code close() noexcept { + error_code m_ec; + if (::closedir(__stream_) == -1) + m_ec = detail::capture_errno(); + __stream_ = nullptr; + return m_ec; + } + + DIR* __stream_{nullptr}; - DIR * __stream_{nullptr}; public: - path __root_; - directory_entry __entry_; + path __root_; + directory_entry __entry_; }; #endif // directory_iterator -directory_iterator::directory_iterator(const path& p, error_code *ec, - directory_options opts) -{ +directory_iterator::directory_iterator(const path& p, error_code* ec, + directory_options opts) { ErrorHandler err("directory_iterator::directory_iterator(...)", ec, &p); error_code m_ec; @@ -248,38 +246,35 @@ directory_iterator::directory_iterator(const path& p, error_code *ec, } } -directory_iterator& directory_iterator::__increment(error_code *ec) -{ - _LIBCPP_ASSERT(__imp_, "Attempting to increment an invalid iterator"); - ErrorHandler err("directory_iterator::operator++()", ec); - - error_code m_ec; - if (!__imp_->advance(m_ec)) { - path root = move(__imp_->__root_); - __imp_.reset(); - if (m_ec) - err.report(m_ec, "at root \"%s\"", root); - } - return *this; +directory_iterator& directory_iterator::__increment(error_code* ec) { + _LIBCPP_ASSERT(__imp_, "Attempting to increment an invalid iterator"); + ErrorHandler err("directory_iterator::operator++()", ec); + error_code m_ec; + if (!__imp_->advance(m_ec)) { + path root = move(__imp_->__root_); + __imp_.reset(); + if (m_ec) + err.report(m_ec, "at root \"%s\"", root); + } + return *this; } directory_entry const& directory_iterator::__dereference() const { - _LIBCPP_ASSERT(__imp_, "Attempting to dereference an invalid iterator"); - return __imp_->__entry_; + _LIBCPP_ASSERT(__imp_, "Attempting to dereference an invalid iterator"); + return __imp_->__entry_; } // recursive_directory_iterator struct recursive_directory_iterator::__shared_imp { stack<__dir_stream> __stack_; - directory_options __options_; + directory_options __options_; }; -recursive_directory_iterator::recursive_directory_iterator(const path& p, - directory_options opt, error_code *ec) - : __imp_(nullptr), __rec_(true) -{ +recursive_directory_iterator::recursive_directory_iterator( + const path& p, directory_options opt, error_code* ec) + : __imp_(nullptr), __rec_(true) { ErrorHandler err("recursive_directory_iterator", ec, &p); error_code m_ec; @@ -294,40 +289,40 @@ recursive_directory_iterator::recursive_directory_iterator(const path& p, __imp_->__stack_.push(move(new_s)); } -void recursive_directory_iterator::__pop(error_code* ec) -{ - _LIBCPP_ASSERT(__imp_, "Popping the end iterator"); - if (ec) ec->clear(); - __imp_->__stack_.pop(); - if (__imp_->__stack_.size() == 0) - __imp_.reset(); - else - __advance(ec); +void recursive_directory_iterator::__pop(error_code* ec) { + _LIBCPP_ASSERT(__imp_, "Popping the end iterator"); + if (ec) + ec->clear(); + __imp_->__stack_.pop(); + if (__imp_->__stack_.size() == 0) + __imp_.reset(); + else + __advance(ec); } directory_options recursive_directory_iterator::options() const { - return __imp_->__options_; + return __imp_->__options_; } int recursive_directory_iterator::depth() const { - return __imp_->__stack_.size() - 1; + return __imp_->__stack_.size() - 1; } const directory_entry& recursive_directory_iterator::__dereference() const { - return __imp_->__stack_.top().__entry_; + return __imp_->__stack_.top().__entry_; } recursive_directory_iterator& -recursive_directory_iterator::__increment(error_code *ec) -{ - if (ec) ec->clear(); - if (recursion_pending()) { - if (__try_recursion(ec) || (ec && *ec)) - return *this; - } - __rec_ = true; - __advance(ec); - return *this; +recursive_directory_iterator::__increment(error_code* ec) { + if (ec) + ec->clear(); + if (recursion_pending()) { + if (__try_recursion(ec) || (ec && *ec)) + return *this; + } + __rec_ = true; + __advance(ec); + return *this; } void recursive_directory_iterator::__advance(error_code* ec) { @@ -344,16 +339,16 @@ void recursive_directory_iterator::__advance(error_code* ec) { stack.pop(); } - if (m_ec) { - path root = move(stack.top().__root_); - __imp_.reset(); - err.report(m_ec, "at root \"%s\"", root); - } else { - __imp_.reset(); - } + if (m_ec) { + path root = move(stack.top().__root_); + __imp_.reset(); + err.report(m_ec, "at root \"%s\"", root); + } else { + __imp_.reset(); + } } -bool recursive_directory_iterator::__try_recursion(error_code *ec) { +bool recursive_directory_iterator::__try_recursion(error_code* ec) { ErrorHandler err("recursive_directory_iterator::operator++()", ec); bool rec_sym = bool(options() & directory_options::follow_directory_symlink); @@ -376,26 +371,26 @@ bool recursive_directory_iterator::__try_recursion(error_code *ec) { skip_rec = true; } - if (!skip_rec) { - __dir_stream new_it(curr_it.__entry_.path(), __imp_->__options_, m_ec); - if (new_it.good()) { - __imp_->__stack_.push(move(new_it)); - return true; - } + if (!skip_rec) { + __dir_stream new_it(curr_it.__entry_.path(), __imp_->__options_, m_ec); + if (new_it.good()) { + __imp_->__stack_.push(move(new_it)); + return true; } - if (m_ec) { - const bool allow_eacess = bool(__imp_->__options_ - & directory_options::skip_permission_denied); - if (m_ec.value() == EACCES && allow_eacess) { - if (ec) ec->clear(); - } else { - path at_ent = move(curr_it.__entry_.__p_); - __imp_.reset(); - err.report(m_ec, "attempting recursion into \"%s\"", at_ent); - } + } + if (m_ec) { + const bool allow_eacess = + bool(__imp_->__options_ & directory_options::skip_permission_denied); + if (m_ec.value() == EACCES && allow_eacess) { + if (ec) + ec->clear(); + } else { + path at_ent = move(curr_it.__entry_.__p_); + __imp_.reset(); + err.report(m_ec, "attempting recursion into \"%s\"", at_ent); } - return false; + } + return false; } - -_LIBCPP_END_NAMESPACE_EXPERIMENTAL_FILESYSTEM +_LIBCPP_END_NAMESPACE_FILESYSTEM diff --git a/src/experimental/filesystem/filesystem_common.h b/src/filesystem/filesystem_common.h similarity index 96% rename from src/experimental/filesystem/filesystem_common.h rename to src/filesystem/filesystem_common.h index 94f4d41cc..ed92877c4 100644 --- a/src/experimental/filesystem/filesystem_common.h +++ b/src/filesystem/filesystem_common.h @@ -10,7 +10,8 @@ #ifndef FILESYSTEM_COMMON_H #define FILESYSTEM_COMMON_H -#include "experimental/__config" +#include "__config" +#include "filesystem" #include "array" #include "chrono" #include "cstdlib" @@ -20,11 +21,9 @@ #include #include #include // for ::utimes as used in __last_write_time -#include /* values for fchmodat */ +#include /* values for fchmodat */ -#include - -#include "../../include/apple_availability.h" +#include "../include/apple_availability.h" #if !defined(__APPLE__) // We can use the presence of UTIME_OMIT to detect platforms that provide @@ -39,7 +38,7 @@ #pragma GCC diagnostic ignored "-Wunused-function" #endif -_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FILESYSTEM +_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM namespace detail { namespace { @@ -49,7 +48,7 @@ static string format_string_imp(const char* msg, ...) { struct GuardVAList { va_list& target; bool active = true; - GuardVAList(va_list &target) : target(target), active(true) {} + GuardVAList(va_list& target) : target(target), active(true) {} void clear() { if (active) va_end(target); @@ -386,10 +385,10 @@ TimeSpec extract_atime(StatT const& st) { return st.st_atim; } // to use it. bool posix_utimes(const path& p, std::array const& TS, - error_code& ec) { + error_code& ec) { using namespace chrono; auto Convert = [](long nsec) { - using int_type = decltype(std::declval<::timeval>().tv_usec); + using int_type = decltype(std::declval< ::timeval>().tv_usec); auto dur = duration_cast(nanoseconds(nsec)).count(); return static_cast(dur); }; @@ -404,9 +403,8 @@ bool posix_utimes(const path& p, std::array const& TS, #if defined(_LIBCPP_USE_UTIMENSAT) bool posix_utimensat(const path& p, std::array const& TS, - error_code& ec) { - if (::utimensat(AT_FDCWD, p.c_str(), TS.data(), 0) == -1) - { + error_code& ec) { + if (::utimensat(AT_FDCWD, p.c_str(), TS.data(), 0) == -1) { ec = capture_errno(); return true; } @@ -423,10 +421,9 @@ bool set_file_times(const path& p, std::array const& TS, #endif } - } // namespace } // end namespace detail -_LIBCPP_END_NAMESPACE_EXPERIMENTAL_FILESYSTEM +_LIBCPP_END_NAMESPACE_FILESYSTEM #endif // FILESYSTEM_COMMON_H diff --git a/src/experimental/filesystem/int128_builtins.cpp b/src/filesystem/int128_builtins.cpp similarity index 97% rename from src/experimental/filesystem/int128_builtins.cpp rename to src/filesystem/int128_builtins.cpp index d8f2abbf9..66adbdd2d 100644 --- a/src/experimental/filesystem/int128_builtins.cpp +++ b/src/filesystem/int128_builtins.cpp @@ -17,7 +17,7 @@ #include "__config" #include "climits" -#ifndef _LIBCPP_HAS_NO_INT128 +#if !defined(_LIBCPP_HAS_NO_INT128) extern "C" __attribute__((no_sanitize("undefined"))) __int128_t __muloti4(__int128_t a, __int128_t b, int* overflow) { diff --git a/src/experimental/filesystem/operations.cpp b/src/filesystem/operations.cpp similarity index 76% rename from src/experimental/filesystem/operations.cpp rename to src/filesystem/operations.cpp index 775c178b3..65a4b3193 100644 --- a/src/experimental/filesystem/operations.cpp +++ b/src/filesystem/operations.cpp @@ -7,11 +7,11 @@ // //===----------------------------------------------------------------------===// -#include "experimental/filesystem" +#include "filesystem" #include "array" #include "iterator" #include "fstream" -#include "random" /* for unique_path */ +#include "random" /* for unique_path */ #include "string_view" #include "type_traits" #include "vector" @@ -24,17 +24,17 @@ #include #include #include -#include /* values for fchmodat */ +#include /* values for fchmodat */ #if defined(__linux__) -# include -# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33) -# include -# define _LIBCPP_USE_SENDFILE -# endif +#include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33) +#include +#define _LIBCPP_USE_SENDFILE +#endif #elif defined(__APPLE__) || __has_include() #include -# define _LIBCPP_USE_COPYFILE +#define _LIBCPP_USE_COPYFILE #endif #if !defined(__APPLE__) @@ -51,10 +51,10 @@ #endif #endif -_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FILESYSTEM +_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM -namespace { namespace parser -{ +namespace { +namespace parser { using string_view_t = path::__string_view; using string_view_pair = pair; @@ -76,8 +76,8 @@ struct PathParser { ParserState State; private: - PathParser(string_view_t P, ParserState State) noexcept - : Path(P), State(State) {} + PathParser(string_view_t P, ParserState State) noexcept : Path(P), + State(State) {} public: PathParser(string_view_t P, string_view_t E, unsigned char S) @@ -157,7 +157,8 @@ public: } } case PS_InTrailingSep: - return makeState(PS_InFilenames, consumeName(RStart, REnd) + 1, RStart + 1); + return makeState(PS_InFilenames, consumeName(RStart, REnd) + 1, + RStart + 1); case PS_InFilenames: { PosPtr SepEnd = consumeSeparator(RStart, REnd); if (SepEnd == REnd) @@ -219,13 +220,9 @@ private: RawEntry = {}; } - PosPtr getAfterBack() const noexcept { - return Path.data() + Path.size(); - } + PosPtr getAfterBack() const noexcept { return Path.data() + Path.size(); } - PosPtr getBeforeFront() const noexcept { - return Path.data() - 1; - } + PosPtr getBeforeFront() const noexcept { return Path.data() - 1; } /// \brief Return a pointer to the first character after the currently /// lexed element. @@ -282,24 +279,26 @@ private: } }; -string_view_pair separate_filename(string_view_t const & s) { - if (s == "." || s == ".." || s.empty()) return string_view_pair{s, ""}; - auto pos = s.find_last_of('.'); - if (pos == string_view_t::npos || pos == 0) - return string_view_pair{s, string_view_t{}}; - return string_view_pair{s.substr(0, pos), s.substr(pos)}; +string_view_pair separate_filename(string_view_t const& s) { + if (s == "." || s == ".." || s.empty()) + return string_view_pair{s, ""}; + auto pos = s.find_last_of('.'); + if (pos == string_view_t::npos || pos == 0) + return string_view_pair{s, string_view_t{}}; + return string_view_pair{s.substr(0, pos), s.substr(pos)}; } string_view_t createView(PosPtr S, PosPtr E) noexcept { return {S, static_cast(E - S) + 1}; } -}} // namespace parser - +} // namespace parser +} // namespace // POSIX HELPERS -namespace detail { namespace { +namespace detail { +namespace { using value_type = path::value_type; using string_type = path::string_type; @@ -429,8 +428,7 @@ file_status posix_lstat(path const& p, error_code* ec) { return posix_lstat(p, path_stat, ec); } -bool posix_ftruncate(const FileDescriptor& fd, size_t to_size, - error_code& ec) { +bool posix_ftruncate(const FileDescriptor& fd, size_t to_size, error_code& ec) { if (::ftruncate(fd.fd, to_size) == -1) { ec = capture_errno(); return true; @@ -462,7 +460,8 @@ file_status FileDescriptor::refresh_status(error_code& ec) { m_status = create_file_status(m_ec, name, m_stat, &ec); return m_status; } -}} // end namespace detail +} // namespace +} // end namespace detail using detail::capture_errno; using detail::ErrorHandler; @@ -511,37 +510,36 @@ void filesystem_error::__create_what(int __num_paths) { }(); } -static path __do_absolute(const path& p, path *cwd, error_code *ec) { - if (ec) ec->clear(); - if (p.is_absolute()) - return p; - *cwd = __current_path(ec); - if (ec && *ec) - return {}; - return (*cwd) / p; +static path __do_absolute(const path& p, path* cwd, error_code* ec) { + if (ec) + ec->clear(); + if (p.is_absolute()) + return p; + *cwd = __current_path(ec); + if (ec && *ec) + return {}; + return (*cwd) / p; } -path __absolute(const path& p, error_code *ec) { - path cwd; - return __do_absolute(p, &cwd, ec); +path __absolute(const path& p, error_code* ec) { + path cwd; + return __do_absolute(p, &cwd, ec); } -path __canonical(path const & orig_p, error_code *ec) -{ - path cwd; - ErrorHandler err("canonical", ec, &orig_p, &cwd); +path __canonical(path const& orig_p, error_code* ec) { + path cwd; + ErrorHandler err("canonical", ec, &orig_p, &cwd); - path p = __do_absolute(orig_p, &cwd, ec); - char buff[PATH_MAX + 1]; - char *ret; - if ((ret = ::realpath(p.c_str(), buff)) == nullptr) - return err.report(capture_errno()); - return {ret}; + path p = __do_absolute(orig_p, &cwd, ec); + char buff[PATH_MAX + 1]; + char* ret; + if ((ret = ::realpath(p.c_str(), buff)) == nullptr) + return err.report(capture_errno()); + return {ret}; } void __copy(const path& from, const path& to, copy_options options, - error_code *ec) -{ + error_code* ec) { ErrorHandler err("copy", ec, &from, &to); const bool sym_status = bool( @@ -570,65 +568,65 @@ void __copy(const path& from, const path& to, copy_options options, return err.report(errc::function_not_supported); } - if (ec) ec->clear(); + if (ec) + ec->clear(); - if (is_symlink(f)) { - if (bool(copy_options::skip_symlinks & options)) { - // do nothing - } else if (not exists(t)) { - __copy_symlink(from, to, ec); - } else { - return err.report(errc::file_exists); - } - return; + if (is_symlink(f)) { + if (bool(copy_options::skip_symlinks & options)) { + // do nothing + } else if (not exists(t)) { + __copy_symlink(from, to, ec); + } else { + return err.report(errc::file_exists); } - else if (is_regular_file(f)) { - if (bool(copy_options::directories_only & options)) { - // do nothing - } - else if (bool(copy_options::create_symlinks & options)) { - __create_symlink(from, to, ec); - } - else if (bool(copy_options::create_hard_links & options)) { - __create_hard_link(from, to, ec); - } - else if (is_directory(t)) { - __copy_file(from, to / from.filename(), options, ec); - } else { - __copy_file(from, to, options, ec); - } - return; + return; + } else if (is_regular_file(f)) { + if (bool(copy_options::directories_only & options)) { + // do nothing + } else if (bool(copy_options::create_symlinks & options)) { + __create_symlink(from, to, ec); + } else if (bool(copy_options::create_hard_links & options)) { + __create_hard_link(from, to, ec); + } else if (is_directory(t)) { + __copy_file(from, to / from.filename(), options, ec); + } else { + __copy_file(from, to, options, ec); } - else if (is_directory(f) && bool(copy_options::create_symlinks & options)) { - return err.report(errc::is_a_directory); - } - else if (is_directory(f) && (bool(copy_options::recursive & options) || - copy_options::none == options)) { + return; + } else if (is_directory(f) && bool(copy_options::create_symlinks & options)) { + return err.report(errc::is_a_directory); + } else if (is_directory(f) && (bool(copy_options::recursive & options) || + copy_options::none == options)) { - if (!exists(t)) { - // create directory to with attributes from 'from'. - __create_directory(to, from, ec); - if (ec && *ec) { return; } - } - directory_iterator it = ec ? directory_iterator(from, *ec) - : directory_iterator(from); - if (ec && *ec) { return; } - error_code m_ec2; - for (; it != directory_iterator(); it.increment(m_ec2)) { - if (m_ec2) { - return err.report(m_ec2); - } - __copy(it->path(), to / it->path().filename(), - options | copy_options::__in_recursive_copy, ec); - if (ec && *ec) { return; } - } + if (!exists(t)) { + // create directory to with attributes from 'from'. + __create_directory(to, from, ec); + if (ec && *ec) { + return; + } } + directory_iterator it = + ec ? directory_iterator(from, *ec) : directory_iterator(from); + if (ec && *ec) { + return; + } + error_code m_ec2; + for (; it != directory_iterator(); it.increment(m_ec2)) { + if (m_ec2) { + return err.report(m_ec2); + } + __copy(it->path(), to / it->path().filename(), + options | copy_options::__in_recursive_copy, ec); + if (ec && *ec) { + return; + } + } + } } namespace detail { namespace { - #ifdef _LIBCPP_USE_SENDFILE bool copy_file_impl_sendfile(FileDescriptor& read_fd, FileDescriptor& write_fd, error_code& ec) { @@ -721,8 +719,7 @@ bool copy_file_impl(FileDescriptor& from, FileDescriptor& to, error_code& ec) { } // namespace detail bool __copy_file(const path& from, const path& to, copy_options options, - error_code *ec) -{ + error_code* ec) { using detail::FileDescriptor; ErrorHandler err("copy_file", ec, &to, &from); @@ -811,18 +808,18 @@ bool __copy_file(const path& from, const path& to, copy_options options, } void __copy_symlink(const path& existing_symlink, const path& new_symlink, - error_code *ec) -{ - const path real_path(__read_symlink(existing_symlink, ec)); - if (ec && *ec) { return; } - // NOTE: proposal says you should detect if you should call - // create_symlink or create_directory_symlink. I don't think this - // is needed with POSIX - __create_symlink(real_path, new_symlink, ec); + error_code* ec) { + const path real_path(__read_symlink(existing_symlink, ec)); + if (ec && *ec) { + return; + } + // NOTE: proposal says you should detect if you should call + // create_symlink or create_directory_symlink. I don't think this + // is needed with POSIX + __create_symlink(real_path, new_symlink, ec); } -bool __create_directories(const path& p, error_code *ec) -{ +bool __create_directories(const path& p, error_code* ec) { ErrorHandler err("create_directories", ec, &p); error_code m_ec; @@ -846,11 +843,10 @@ bool __create_directories(const path& p, error_code *ec) } } } - return __create_directory(p, ec); + return __create_directory(p, ec); } -bool __create_directory(const path& p, error_code *ec) -{ +bool __create_directory(const path& p, error_code* ec) { ErrorHandler err("create_directory", ec, &p); if (::mkdir(p.c_str(), static_cast(perms::all)) == 0) @@ -860,9 +856,7 @@ bool __create_directory(const path& p, error_code *ec) return false; } -bool __create_directory(path const & p, path const & attributes, - error_code *ec) -{ +bool __create_directory(path const& p, path const& attributes, error_code* ec) { ErrorHandler err("create_directory", ec, &p, &attributes); StatT attr_stat; @@ -871,7 +865,8 @@ bool __create_directory(path const & p, path const & attributes, if (!status_known(st)) return err.report(mec); if (!is_directory(st)) - return err.report(errc::not_a_directory, "the specified attribute path is invalid"); + return err.report(errc::not_a_directory, + "the specified attribute path is invalid"); if (::mkdir(p.c_str(), attr_stat.st_mode) == 0) return true; @@ -887,19 +882,19 @@ void __create_directory_symlink(path const& from, path const& to, return err.report(capture_errno()); } -void __create_hard_link(const path& from, const path& to, error_code *ec){ +void __create_hard_link(const path& from, const path& to, error_code* ec) { ErrorHandler err("create_hard_link", ec, &from, &to); if (::link(from.c_str(), to.c_str()) == -1) return err.report(capture_errno()); } -void __create_symlink(path const & from, path const & to, error_code *ec) { +void __create_symlink(path const& from, path const& to, error_code* ec) { ErrorHandler err("create_symlink", ec, &from, &to); if (::symlink(from.c_str(), to.c_str()) == -1) return err.report(capture_errno()); } -path __current_path(error_code *ec) { +path __current_path(error_code* ec) { ErrorHandler err("current_path", ec); auto size = ::pathconf(".", _PC_PATH_MAX); @@ -913,14 +908,13 @@ path __current_path(error_code *ec) { return {buff.get()}; } -void __current_path(const path& p, error_code *ec) { +void __current_path(const path& p, error_code* ec) { ErrorHandler err("current_path", ec, &p); if (::chdir(p.c_str()) == -1) err.report(capture_errno()); } -bool __equivalent(const path& p1, const path& p2, error_code *ec) -{ +bool __equivalent(const path& p1, const path& p2, error_code* ec) { ErrorHandler err("equivalent", ec, &p1, &p2); error_code ec1, ec2; @@ -935,9 +929,7 @@ bool __equivalent(const path& p1, const path& p2, error_code *ec) return detail::stat_equivalent(st1, st2); } - -uintmax_t __file_size(const path& p, error_code *ec) -{ +uintmax_t __file_size(const path& p, error_code* ec) { ErrorHandler err("file_size", ec, &p); error_code m_ec; @@ -950,12 +942,11 @@ uintmax_t __file_size(const path& p, error_code *ec) m_ec = make_error_code(error_kind); return err.report(m_ec); } - // is_regular_file(p) == true - return static_cast(st.st_size); + // is_regular_file(p) == true + return static_cast(st.st_size); } -uintmax_t __hard_link_count(const path& p, error_code *ec) -{ +uintmax_t __hard_link_count(const path& p, error_code* ec) { ErrorHandler err("hard_link_count", ec, &p); error_code m_ec; @@ -966,9 +957,7 @@ uintmax_t __hard_link_count(const path& p, error_code *ec) return static_cast(st.st_nlink); } - -bool __fs_is_empty(const path& p, error_code *ec) -{ +bool __fs_is_empty(const path& p, error_code* ec) { ErrorHandler err("is_empty", ec, &p); error_code m_ec; @@ -1001,52 +990,47 @@ static file_time_type __extract_last_write_time(const path& p, const StatT& st, return fs_time::convert_from_timespec(ts); } -file_time_type __last_write_time(const path& p, error_code *ec) -{ - using namespace chrono; - ErrorHandler err("last_write_time", ec, &p); +file_time_type __last_write_time(const path& p, error_code* ec) { + using namespace chrono; + ErrorHandler err("last_write_time", ec, &p); - error_code m_ec; - StatT st; - detail::posix_stat(p, st, &m_ec); - if (m_ec) - return err.report(m_ec); - return __extract_last_write_time(p, st, ec); + error_code m_ec; + StatT st; + detail::posix_stat(p, st, &m_ec); + if (m_ec) + return err.report(m_ec); + return __extract_last_write_time(p, st, ec); } -void __last_write_time(const path& p, file_time_type new_time, - error_code *ec) -{ - using detail::fs_time; - ErrorHandler err("last_write_time", ec, &p); +void __last_write_time(const path& p, file_time_type new_time, error_code* ec) { + using detail::fs_time; + ErrorHandler err("last_write_time", ec, &p); - error_code m_ec; - array tbuf; + error_code m_ec; + array tbuf; #if !defined(_LIBCPP_USE_UTIMENSAT) - // This implementation has a race condition between determining the - // last access time and attempting to set it to the same value using - // ::utimes - StatT st; - file_status fst = detail::posix_stat(p, st, &m_ec); - if (m_ec) - return err.report(m_ec); - tbuf[0] = detail::extract_atime(st); + // This implementation has a race condition between determining the + // last access time and attempting to set it to the same value using + // ::utimes + StatT st; + file_status fst = detail::posix_stat(p, st, &m_ec); + if (m_ec) + return err.report(m_ec); + tbuf[0] = detail::extract_atime(st); #else - tbuf[0].tv_sec = 0; - tbuf[0].tv_nsec = UTIME_OMIT; + tbuf[0].tv_sec = 0; + tbuf[0].tv_nsec = UTIME_OMIT; #endif - if (!fs_time::convert_to_timespec(tbuf[1], new_time)) - return err.report(errc::value_too_large); + if (!fs_time::convert_to_timespec(tbuf[1], new_time)) + return err.report(errc::value_too_large); - detail::set_file_times(p, tbuf, m_ec); - if (m_ec) - return err.report(m_ec); + detail::set_file_times(p, tbuf, m_ec); + if (m_ec) + return err.report(m_ec); } - void __permissions(const path& p, perms prms, perm_options opts, - error_code *ec) -{ + error_code* ec) { ErrorHandler err("permissions", ec, &p); auto has_opt = [&](perm_options o) { return bool(o & opts); }; @@ -1074,24 +1058,23 @@ void __permissions(const path& p, perms prms, perm_options opts, else if (remove_perms) prms = st.permissions() & ~prms; } - const auto real_perms = detail::posix_convert_perms(prms); + const auto real_perms = detail::posix_convert_perms(prms); -# if defined(AT_SYMLINK_NOFOLLOW) && defined(AT_FDCWD) - const int flags = set_sym_perms ? AT_SYMLINK_NOFOLLOW : 0; - if (::fchmodat(AT_FDCWD, p.c_str(), real_perms, flags) == -1) { - return err.report(capture_errno()); - } -# else - if (set_sym_perms) - return err.report(errc::operation_not_supported); - if (::chmod(p.c_str(), real_perms) == -1) { - return err.report(capture_errno()); - } -# endif +#if defined(AT_SYMLINK_NOFOLLOW) && defined(AT_FDCWD) + const int flags = set_sym_perms ? AT_SYMLINK_NOFOLLOW : 0; + if (::fchmodat(AT_FDCWD, p.c_str(), real_perms, flags) == -1) { + return err.report(capture_errno()); + } +#else + if (set_sym_perms) + return err.report(errc::operation_not_supported); + if (::chmod(p.c_str(), real_perms) == -1) { + return err.report(capture_errno()); + } +#endif } - -path __read_symlink(const path& p, error_code *ec) { +path __read_symlink(const path& p, error_code* ec) { ErrorHandler err("read_symlink", ec, &p); char buff[PATH_MAX + 1]; @@ -1100,47 +1083,49 @@ path __read_symlink(const path& p, error_code *ec) { if ((ret = ::readlink(p.c_str(), buff, PATH_MAX)) == -1) { return err.report(capture_errno()); } - _LIBCPP_ASSERT(ret <= PATH_MAX, "TODO"); - _LIBCPP_ASSERT(ret > 0, "TODO"); - buff[ret] = 0; - return {buff}; + _LIBCPP_ASSERT(ret <= PATH_MAX, "TODO"); + _LIBCPP_ASSERT(ret > 0, "TODO"); + buff[ret] = 0; + return {buff}; } - -bool __remove(const path& p, error_code *ec) { +bool __remove(const path& p, error_code* ec) { ErrorHandler err("remove", ec, &p); if (::remove(p.c_str()) == -1) { if (errno != ENOENT) err.report(capture_errno()); return false; } - return true; + return true; } namespace { -uintmax_t remove_all_impl(path const & p, error_code& ec) -{ - const auto npos = static_cast(-1); - const file_status st = __symlink_status(p, &ec); - if (ec) return npos; - uintmax_t count = 1; - if (is_directory(st)) { - for (directory_iterator it(p, ec); !ec && it != directory_iterator(); - it.increment(ec)) { - auto other_count = remove_all_impl(it->path(), ec); - if (ec) return npos; - count += other_count; - } - if (ec) return npos; +uintmax_t remove_all_impl(path const& p, error_code& ec) { + const auto npos = static_cast(-1); + const file_status st = __symlink_status(p, &ec); + if (ec) + return npos; + uintmax_t count = 1; + if (is_directory(st)) { + for (directory_iterator it(p, ec); !ec && it != directory_iterator(); + it.increment(ec)) { + auto other_count = remove_all_impl(it->path(), ec); + if (ec) + return npos; + count += other_count; } - if (!__remove(p, &ec)) return npos; - return count; + if (ec) + return npos; + } + if (!__remove(p, &ec)) + return npos; + return count; } } // end namespace -uintmax_t __remove_all(const path& p, error_code *ec) { +uintmax_t __remove_all(const path& p, error_code* ec) { ErrorHandler err("remove_all", ec, &p); error_code mec; @@ -1150,22 +1135,22 @@ uintmax_t __remove_all(const path& p, error_code *ec) { return 0; return err.report(mec); } - return count; + return count; } -void __rename(const path& from, const path& to, error_code *ec) { +void __rename(const path& from, const path& to, error_code* ec) { ErrorHandler err("rename", ec, &from, &to); if (::rename(from.c_str(), to.c_str()) == -1) err.report(capture_errno()); } -void __resize_file(const path& p, uintmax_t size, error_code *ec) { +void __resize_file(const path& p, uintmax_t size, error_code* ec) { ErrorHandler err("resize_file", ec, &p); if (::truncate(p.c_str(), static_cast< ::off_t>(size)) == -1) return err.report(capture_errno()); } -space_info __space(const path& p, error_code *ec) { +space_info __space(const path& p, error_code* ec) { ErrorHandler err("space", ec, &p); space_info si; struct statvfs m_svfs = {}; @@ -1174,24 +1159,24 @@ space_info __space(const path& p, error_code *ec) { si.capacity = si.free = si.available = static_cast(-1); return si; } - // Multiply with overflow checking. - auto do_mult = [&](uintmax_t& out, uintmax_t other) { - out = other * m_svfs.f_frsize; - if (other == 0 || out / other != m_svfs.f_frsize) - out = static_cast(-1); - }; - do_mult(si.capacity, m_svfs.f_blocks); - do_mult(si.free, m_svfs.f_bfree); - do_mult(si.available, m_svfs.f_bavail); - return si; + // Multiply with overflow checking. + auto do_mult = [&](uintmax_t& out, uintmax_t other) { + out = other * m_svfs.f_frsize; + if (other == 0 || out / other != m_svfs.f_frsize) + out = static_cast(-1); + }; + do_mult(si.capacity, m_svfs.f_blocks); + do_mult(si.free, m_svfs.f_bfree); + do_mult(si.available, m_svfs.f_bavail); + return si; } -file_status __status(const path& p, error_code *ec) { - return detail::posix_stat(p, ec); +file_status __status(const path& p, error_code* ec) { + return detail::posix_stat(p, ec); } -file_status __symlink_status(const path& p, error_code *ec) { - return detail::posix_lstat(p, ec); +file_status __symlink_status(const path& p, error_code* ec) { + return detail::posix_lstat(p, ec); } path __temp_directory_path(error_code* ec) { @@ -1219,8 +1204,7 @@ path __temp_directory_path(error_code* ec) { return p; } - -path __weakly_canonical(const path& p, error_code *ec) { +path __weakly_canonical(const path& p, error_code* ec) { ErrorHandler err("weakly_canonical", ec, &p); if (p.empty()) @@ -1248,10 +1232,11 @@ path __weakly_canonical(const path& p, error_code *ec) { } if (PP.State == PathParser::PS_BeforeBegin) result = __canonical("", ec); - if (ec) ec->clear(); + if (ec) + ec->clear(); if (DNEParts.empty()) return result; - for (auto It=DNEParts.rbegin(); It != DNEParts.rend(); ++It) + for (auto It = DNEParts.rbegin(); It != DNEParts.rend(); ++It) result /= *It; return result.lexically_normal(); } @@ -1262,56 +1247,52 @@ path __weakly_canonical(const path& p, error_code *ec) { constexpr path::value_type path::preferred_separator; -path & path::replace_extension(path const & replacement) -{ - path p = extension(); - if (not p.empty()) { - __pn_.erase(__pn_.size() - p.native().size()); +path& path::replace_extension(path const& replacement) { + path p = extension(); + if (not p.empty()) { + __pn_.erase(__pn_.size() - p.native().size()); + } + if (!replacement.empty()) { + if (replacement.native()[0] != '.') { + __pn_ += "."; } - if (!replacement.empty()) { - if (replacement.native()[0] != '.') { - __pn_ += "."; - } - __pn_.append(replacement.__pn_); - } - return *this; + __pn_.append(replacement.__pn_); + } + return *this; } /////////////////////////////////////////////////////////////////////////////// // path.decompose -string_view_t path::__root_name() const -{ - auto PP = PathParser::CreateBegin(__pn_); - if (PP.State == PathParser::PS_InRootName) - return *PP; - return {}; +string_view_t path::__root_name() const { + auto PP = PathParser::CreateBegin(__pn_); + if (PP.State == PathParser::PS_InRootName) + return *PP; + return {}; } -string_view_t path::__root_directory() const -{ - auto PP = PathParser::CreateBegin(__pn_); - if (PP.State == PathParser::PS_InRootName) +string_view_t path::__root_directory() const { + auto PP = PathParser::CreateBegin(__pn_); + if (PP.State == PathParser::PS_InRootName) + ++PP; + if (PP.State == PathParser::PS_InRootDir) + return *PP; + return {}; +} + +string_view_t path::__root_path_raw() const { + auto PP = PathParser::CreateBegin(__pn_); + if (PP.State == PathParser::PS_InRootName) { + auto NextCh = PP.peek(); + if (NextCh && *NextCh == '/') { ++PP; - if (PP.State == PathParser::PS_InRootDir) - return *PP; - return {}; -} - -string_view_t path::__root_path_raw() const -{ - auto PP = PathParser::CreateBegin(__pn_); - if (PP.State == PathParser::PS_InRootName) { - auto NextCh = PP.peek(); - if (NextCh && *NextCh == '/') { - ++PP; - return createView(__pn_.data(), &PP.RawEntry.back()); - } - return PP.RawEntry; + return createView(__pn_.data(), &PP.RawEntry.back()); } - if (PP.State == PathParser::PS_InRootDir) - return *PP; - return {}; + return PP.RawEntry; + } + if (PP.State == PathParser::PS_InRootDir) + return *PP; + return {}; } static bool ConsumeRootDir(PathParser* PP) { @@ -1320,62 +1301,57 @@ static bool ConsumeRootDir(PathParser* PP) { return PP->State == PathParser::PS_AtEnd; } -string_view_t path::__relative_path() const -{ +string_view_t path::__relative_path() const { + auto PP = PathParser::CreateBegin(__pn_); + if (ConsumeRootDir(&PP)) + return {}; + return createView(PP.RawEntry.data(), &__pn_.back()); +} + +string_view_t path::__parent_path() const { + if (empty()) + return {}; + // Determine if we have a root path but not a relative path. In that case + // return *this. + { auto PP = PathParser::CreateBegin(__pn_); if (ConsumeRootDir(&PP)) + return __pn_; + } + // Otherwise remove a single element from the end of the path, and return + // a string representing that path + { + auto PP = PathParser::CreateEnd(__pn_); + --PP; + if (PP.RawEntry.data() == __pn_.data()) return {}; - return createView(PP.RawEntry.data(), &__pn_.back()); + --PP; + return createView(__pn_.data(), &PP.RawEntry.back()); + } } -string_view_t path::__parent_path() const -{ - if (empty()) +string_view_t path::__filename() const { + if (empty()) + return {}; + { + PathParser PP = PathParser::CreateBegin(__pn_); + if (ConsumeRootDir(&PP)) return {}; - // Determine if we have a root path but not a relative path. In that case - // return *this. - { - auto PP = PathParser::CreateBegin(__pn_); - if (ConsumeRootDir(&PP)) - return __pn_; - } - // Otherwise remove a single element from the end of the path, and return - // a string representing that path - { - auto PP = PathParser::CreateEnd(__pn_); - --PP; - if (PP.RawEntry.data() == __pn_.data()) - return {}; - --PP; - return createView(__pn_.data(), &PP.RawEntry.back()); - } + } + return *(--PathParser::CreateEnd(__pn_)); } -string_view_t path::__filename() const -{ - if (empty()) return {}; - { - PathParser PP = PathParser::CreateBegin(__pn_); - if (ConsumeRootDir(&PP)) - return {}; - } - return *(--PathParser::CreateEnd(__pn_)); +string_view_t path::__stem() const { + return parser::separate_filename(__filename()).first; } -string_view_t path::__stem() const -{ - return parser::separate_filename(__filename()).first; -} - -string_view_t path::__extension() const -{ - return parser::separate_filename(__filename()).second; +string_view_t path::__extension() const { + return parser::separate_filename(__filename()).second; } //////////////////////////////////////////////////////////////////////////// // path.gen - enum PathPartKind : unsigned char { PK_None, PK_RootSep, @@ -1456,7 +1432,7 @@ path path::lexically_normal() const { } // [fs.path.generic]p6.8: If the path is empty, add a dot. if (Parts.empty()) - return "."; + return "."; // [fs.path.generic]p6.7: If the last filename is dot-dot, remove any // trailing directory-separator. @@ -1464,7 +1440,7 @@ path path::lexically_normal() const { path Result; Result.__pn_.reserve(Parts.size() + NewPathSize + NeedTrailingSep); - for (auto &PK : Parts) + for (auto& PK : Parts) Result /= PK.first; if (NeedTrailingSep) @@ -1490,8 +1466,8 @@ path path::lexically_relative(const path& base) const { auto PP = PathParser::CreateBegin(__pn_); auto PPBase = PathParser::CreateBegin(base.__pn_); auto CheckIterMismatchAtBase = [&]() { - return PP.State != PPBase.State && ( - PP.inRootPath() || PPBase.inRootPath()); + return PP.State != PPBase.State && + (PP.inRootPath() || PPBase.inRootPath()); }; if (PP.State == PathParser::PS_InRootName && PPBase.State == PathParser::PS_InRootName) { @@ -1500,8 +1476,10 @@ path path::lexically_relative(const path& base) const { } else if (CheckIterMismatchAtBase()) return {}; - if (PP.inRootPath()) ++PP; - if (PPBase.inRootPath()) ++PPBase; + if (PP.inRootPath()) + ++PP; + if (PPBase.inRootPath()) + ++PPBase; if (CheckIterMismatchAtBase()) return {}; } @@ -1509,8 +1487,7 @@ path path::lexically_relative(const path& base) const { // Find the first mismatching element auto PP = PathParser::CreateBegin(__pn_); auto PPBase = PathParser::CreateBegin(base.__pn_); - while (PP && PPBase && PP.State == PPBase.State && - *PP == *PPBase) { + while (PP && PPBase && PP.State == PPBase.State && *PP == *PPBase) { ++PP; ++PPBase; } @@ -1539,18 +1516,20 @@ path path::lexically_relative(const path& base) const { //////////////////////////////////////////////////////////////////////////// // path.comparisons int path::__compare(string_view_t __s) const { - auto PP = PathParser::CreateBegin(__pn_); - auto PP2 = PathParser::CreateBegin(__s); - while (PP && PP2) { - int res = (*PP).compare(*PP2); - if (res != 0) return res; - ++PP; ++PP2; - } - if (PP.State == PP2.State && !PP) - return 0; - if (!PP) - return -1; - return 1; + auto PP = PathParser::CreateBegin(__pn_); + auto PP2 = PathParser::CreateBegin(__s); + while (PP && PP2) { + int res = (*PP).compare(*PP2); + if (res != 0) + return res; + ++PP; + ++PP2; + } + if (PP.State == PP2.State && !PP) + return 0; + if (!PP) + return -1; + return 1; } //////////////////////////////////////////////////////////////////////////// @@ -1568,23 +1547,21 @@ size_t hash_value(const path& __p) noexcept { //////////////////////////////////////////////////////////////////////////// // path.itr -path::iterator path::begin() const -{ - auto PP = PathParser::CreateBegin(__pn_); - iterator it; - it.__path_ptr_ = this; - it.__state_ = static_cast(PP.State); - it.__entry_ = PP.RawEntry; - it.__stashed_elem_.__assign_view(*PP); - return it; +path::iterator path::begin() const { + auto PP = PathParser::CreateBegin(__pn_); + iterator it; + it.__path_ptr_ = this; + it.__state_ = static_cast(PP.State); + it.__entry_ = PP.RawEntry; + it.__stashed_elem_.__assign_view(*PP); + return it; } -path::iterator path::end() const -{ - iterator it{}; - it.__state_ = path::iterator::_AtEnd; - it.__path_ptr_ = this; - return it; +path::iterator path::end() const { + iterator it{}; + it.__state_ = path::iterator::_AtEnd; + it.__path_ptr_ = this; + return it; } path::iterator& path::iterator::__increment() { @@ -1706,4 +1683,4 @@ error_code directory_entry::__do_refresh() noexcept { } #endif -_LIBCPP_END_NAMESPACE_EXPERIMENTAL_FILESYSTEM +_LIBCPP_END_NAMESPACE_FILESYSTEM diff --git a/test/libcxx/double_include.sh.cpp b/test/libcxx/double_include.sh.cpp index dfc3d0116..c98cc8065 100644 --- a/test/libcxx/double_include.sh.cpp +++ b/test/libcxx/double_include.sh.cpp @@ -62,6 +62,7 @@ #include #include #include +#include #include #include #include diff --git a/test/libcxx/experimental/filesystem/version.pass.cpp b/test/libcxx/experimental/filesystem/version.pass.cpp index 723380a26..d5f36a6b3 100644 --- a/test/libcxx/experimental/filesystem/version.pass.cpp +++ b/test/libcxx/experimental/filesystem/version.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // #include diff --git a/test/libcxx/experimental/filesystem/class.directory_entry/directory_entry.mods/last_write_time.sh.cpp b/test/libcxx/input.output/filesystems/class.directory_entry/directory_entry.mods/last_write_time.sh.cpp similarity index 96% rename from test/libcxx/experimental/filesystem/class.directory_entry/directory_entry.mods/last_write_time.sh.cpp rename to test/libcxx/input.output/filesystems/class.directory_entry/directory_entry.mods/last_write_time.sh.cpp index 7f4ed6730..6372755fc 100644 --- a/test/libcxx/experimental/filesystem/class.directory_entry/directory_entry.mods/last_write_time.sh.cpp +++ b/test/libcxx/input.output/filesystems/class.directory_entry/directory_entry.mods/last_write_time.sh.cpp @@ -9,11 +9,11 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_entry -// RUN: %build -I%libcxx_src_root/src/experimental/filesystem +// RUN: %build -I%libcxx_src_root/src/filesystem // RUN: %run #include "filesystem_include.hpp" diff --git a/test/libcxx/experimental/filesystem/class.path/path.itr/iterator_db.pass.cpp b/test/libcxx/input.output/filesystems/class.path/path.itr/iterator_db.pass.cpp similarity index 93% rename from test/libcxx/experimental/filesystem/class.path/path.itr/iterator_db.pass.cpp rename to test/libcxx/input.output/filesystems/class.path/path.itr/iterator_db.pass.cpp index b8b7124ad..405f9abc2 100644 --- a/test/libcxx/experimental/filesystem/class.path/path.itr/iterator_db.pass.cpp +++ b/test/libcxx/input.output/filesystems/class.path/path.itr/iterator_db.pass.cpp @@ -13,13 +13,13 @@ // MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS // MODULES_DEFINES: _LIBCPP_DEBUG=0 -// +// // class path #define _LIBCPP_DEBUG 0 #define _LIBCPP_DEBUG_USE_EXCEPTIONS -#include +#include "filesystem_include.hpp" #include #include #include @@ -27,8 +27,6 @@ #include "test_macros.h" #include "filesystem_test_helper.hpp" -namespace fs = std::experimental::filesystem; - int main() { using namespace fs; using ExType = std::__libcpp_debug_exception; diff --git a/test/libcxx/experimental/filesystem/class.path/path.itr/reverse_iterator_produces_diagnostic.fail.cpp b/test/libcxx/input.output/filesystems/class.path/path.itr/reverse_iterator_produces_diagnostic.fail.cpp similarity index 87% rename from test/libcxx/experimental/filesystem/class.path/path.itr/reverse_iterator_produces_diagnostic.fail.cpp rename to test/libcxx/input.output/filesystems/class.path/path.itr/reverse_iterator_produces_diagnostic.fail.cpp index 5a6f5304a..992cdebb5 100644 --- a/test/libcxx/experimental/filesystem/class.path/path.itr/reverse_iterator_produces_diagnostic.fail.cpp +++ b/test/libcxx/input.output/filesystems/class.path/path.itr/reverse_iterator_produces_diagnostic.fail.cpp @@ -9,16 +9,14 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path -#include +#include "filesystem_include.hpp" #include -namespace fs = std::experimental::filesystem; - int main() { using namespace fs; using RIt = std::reverse_iterator; diff --git a/test/libcxx/experimental/filesystem/class.path/path.req/is_pathable.pass.cpp b/test/libcxx/input.output/filesystems/class.path/path.req/is_pathable.pass.cpp similarity index 96% rename from test/libcxx/experimental/filesystem/class.path/path.req/is_pathable.pass.cpp rename to test/libcxx/input.output/filesystems/class.path/path.req/is_pathable.pass.cpp index 61d322524..ff0cc5935 100644 --- a/test/libcxx/experimental/filesystem/class.path/path.req/is_pathable.pass.cpp +++ b/test/libcxx/input.output/filesystems/class.path/path.req/is_pathable.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // template struct __is_pathable @@ -21,7 +21,7 @@ // * A character array, which points to a NTCTS after array-to-pointer decay. -#include +#include "filesystem_include.hpp" #include #include @@ -30,8 +30,6 @@ #include "min_allocator.h" #include "constexpr_char_traits.hpp" -namespace fs = std::experimental::filesystem; - using fs::__is_pathable; template diff --git a/test/libcxx/experimental/filesystem/convert_file_time.sh.cpp b/test/libcxx/input.output/filesystems/convert_file_time.sh.cpp similarity index 98% rename from test/libcxx/experimental/filesystem/convert_file_time.sh.cpp rename to test/libcxx/input.output/filesystems/convert_file_time.sh.cpp index 918236641..21a1a4992 100644 --- a/test/libcxx/experimental/filesystem/convert_file_time.sh.cpp +++ b/test/libcxx/input.output/filesystems/convert_file_time.sh.cpp @@ -9,14 +9,14 @@ // UNSUPPORTED: c++98, c++03, c++11 -// +// // typedef TrivialClock file_time_type; -// RUN: %build -I%libcxx_src_root/src/experimental/filesystem +// RUN: %build -I%libcxx_src_root/src/filesystem // RUN: %run -#include +#include #include #include #include @@ -30,7 +30,7 @@ #endif using namespace std::chrono; -namespace fs = std::experimental::filesystem; +namespace fs = std::__fs::filesystem; using fs::file_time_type; using fs::detail::time_util; diff --git a/test/libcxx/experimental/filesystem/lit.local.cfg b/test/libcxx/input.output/filesystems/lit.local.cfg similarity index 100% rename from test/libcxx/experimental/filesystem/lit.local.cfg rename to test/libcxx/input.output/filesystems/lit.local.cfg diff --git a/test/libcxx/input.output/filesystems/version.pass.cpp b/test/libcxx/input.output/filesystems/version.pass.cpp new file mode 100644 index 000000000..f680217ef --- /dev/null +++ b/test/libcxx/input.output/filesystems/version.pass.cpp @@ -0,0 +1,20 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +#include + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() +{ +} diff --git a/test/std/input.output/file.streams/fstreams/filebuf.members/open_path.pass.cpp b/test/std/input.output/file.streams/fstreams/filebuf.members/open_path.pass.cpp new file mode 100644 index 000000000..02e2b607e --- /dev/null +++ b/test/std/input.output/file.streams/fstreams/filebuf.members/open_path.pass.cpp @@ -0,0 +1,56 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// + +// basic_filebuf* open(const filesystem::path& p, ios_base::openmode mode); + +#include +#include +#include +#include "platform_support.h" + +namespace fs = std::filesystem; + +int main() { + + fs::path p = get_temp_file_name(); + { + std::filebuf f; + assert(f.open(p, std::ios_base::out) != 0); + assert(f.is_open()); + assert(f.sputn("123", 3) == 3); + } + { + std::filebuf f; + assert(f.open(p, std::ios_base::in) != 0); + assert(f.is_open()); + assert(f.sbumpc() == '1'); + assert(f.sbumpc() == '2'); + assert(f.sbumpc() == '3'); + } + std::remove(p.c_str()); + { + std::wfilebuf f; + assert(f.open(p, std::ios_base::out) != 0); + assert(f.is_open()); + assert(f.sputn(L"123", 3) == 3); + } + { + std::wfilebuf f; + assert(f.open(p, std::ios_base::in) != 0); + assert(f.is_open()); + assert(f.sbumpc() == L'1'); + assert(f.sbumpc() == L'2'); + assert(f.sbumpc() == L'3'); + } + remove(p.c_str()); +} diff --git a/test/std/input.output/file.streams/fstreams/fstream.cons/path.pass.cpp b/test/std/input.output/file.streams/fstreams/fstream.cons/path.pass.cpp new file mode 100644 index 000000000..d9b4a8ccb --- /dev/null +++ b/test/std/input.output/file.streams/fstreams/fstream.cons/path.pass.cpp @@ -0,0 +1,49 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// + +// plate > +// class basic_fstream + +// explicit basic_fstream(const filesystem::path& s, +// ios_base::openmode mode = ios_base::in|ios_base::out); + +#include +#include +#include +#include "platform_support.h" + +namespace fs = std::filesystem; + +int main() { + fs::path p = get_temp_file_name(); + { + std::fstream fs(p, std::ios_base::in | std::ios_base::out | + std::ios_base::trunc); + double x = 0; + fs << 3.25; + fs.seekg(0); + fs >> x; + assert(x == 3.25); + } + std::remove(p.c_str()); + { + std::wfstream fs(p, std::ios_base::in | std::ios_base::out | + std::ios_base::trunc); + double x = 0; + fs << 3.25; + fs.seekg(0); + fs >> x; + assert(x == 3.25); + } + std::remove(p.c_str()); +} diff --git a/test/std/input.output/file.streams/fstreams/fstream.members/open_path.pass.cpp b/test/std/input.output/file.streams/fstreams/fstream.members/open_path.pass.cpp new file mode 100644 index 000000000..69cbf3f5c --- /dev/null +++ b/test/std/input.output/file.streams/fstreams/fstream.members/open_path.pass.cpp @@ -0,0 +1,52 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// + +// plate > +// class basic_fstream + +// void open(const filesystem::path& s, ios_base::openmode mode = ios_base::in|ios_base::out); + +#include +#include +#include +#include "platform_support.h" + +int main() { + std::filesystem::path p = get_temp_file_name(); + { + std::fstream stream; + assert(!stream.is_open()); + stream.open(p, + std::ios_base::in | std::ios_base::out | std::ios_base::trunc); + assert(stream.is_open()); + double x = 0; + stream << 3.25; + stream.seekg(0); + stream >> x; + assert(x == 3.25); + } + std::remove(p.c_str()); + { + std::wfstream stream; + assert(!stream.is_open()); + stream.open(p, + std::ios_base::in | std::ios_base::out | std::ios_base::trunc); + assert(stream.is_open()); + double x = 0; + stream << 3.25; + stream.seekg(0); + stream >> x; + assert(x == 3.25); + } + std::remove(p.c_str()); +} diff --git a/test/std/input.output/file.streams/fstreams/ifstream.cons/path.pass.cpp b/test/std/input.output/file.streams/fstreams/ifstream.cons/path.pass.cpp new file mode 100644 index 000000000..99eae3a28 --- /dev/null +++ b/test/std/input.output/file.streams/fstreams/ifstream.cons/path.pass.cpp @@ -0,0 +1,53 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// + +// template > +// class basic_ifstream + +// explicit basic_ifstream(const filesystem::path& s, +// ios_base::openmode mode = ios_base::in); + +#include +#include +#include + +namespace fs = std::filesystem; + +int main() { + { + fs::path p; + static_assert(!std::is_convertible::value, + "ctor should be explicit"); + static_assert(std::is_constructible::value, + ""); + } + { + std::ifstream fs(fs::path("test.dat")); + double x = 0; + fs >> x; + assert(x == 3.25); + } + // std::ifstream(const fs::path&, std::ios_base::openmode) is tested in + // test/std/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp + // which creates writable files. + { + std::wifstream fs(fs::path("test.dat")); + double x = 0; + fs >> x; + assert(x == 3.25); + } + // std::wifstream(const fs::path&, std::ios_base::openmode) is tested in + // test/std/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp + // which creates writable files. +} diff --git a/test/std/input.output/file.streams/fstreams/ifstream.members/open_path.pass.cpp b/test/std/input.output/file.streams/fstreams/ifstream.members/open_path.pass.cpp new file mode 100644 index 000000000..82f7c64eb --- /dev/null +++ b/test/std/input.output/file.streams/fstreams/ifstream.members/open_path.pass.cpp @@ -0,0 +1,48 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// + +// template > +// class basic_ifstream + +// void open(const filesystem::path& s, ios_base::openmode mode = ios_base::in); + +#include +#include +#include + +int main() { + { + std::ifstream fs; + assert(!fs.is_open()); + char c = 'a'; + fs >> c; + assert(fs.fail()); + assert(c == 'a'); + fs.open(std::filesystem::path("test.dat")); + assert(fs.is_open()); + fs >> c; + assert(c == 'r'); + } + { + std::wifstream fs; + assert(!fs.is_open()); + wchar_t c = L'a'; + fs >> c; + assert(fs.fail()); + assert(c == L'a'); + fs.open(std::filesystem::path("test.dat")); + assert(fs.is_open()); + fs >> c; + assert(c == L'r'); + } +} diff --git a/test/std/input.output/file.streams/fstreams/ofstream.cons/path.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.cons/path.pass.cpp new file mode 100644 index 000000000..9a23384b0 --- /dev/null +++ b/test/std/input.output/file.streams/fstreams/ofstream.cons/path.pass.cpp @@ -0,0 +1,69 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// + +// plate > +// class basic_ofstream + +// explicit basic_ofstream(const filesystem::path& s, ios_base::openmode mode = ios_base::out); + +#include +#include +#include +#include "platform_support.h" + +namespace fs = std::filesystem; + +int main() { + fs::path p = get_temp_file_name(); + { + static_assert(!std::is_convertible::value, + "ctor should be explicit"); + static_assert(std::is_constructible::value, + ""); + } + { + std::ofstream stream(p); + stream << 3.25; + } + { + std::ifstream stream(p); + double x = 0; + stream >> x; + assert(x == 3.25); + } + { + std::ifstream stream(p, std::ios_base::out); + double x = 0; + stream >> x; + assert(x == 3.25); + } + std::remove(p.c_str()); + { + std::wofstream stream(p); + stream << 3.25; + } + { + std::wifstream stream(p); + double x = 0; + stream >> x; + assert(x == 3.25); + } + { + std::wifstream stream(p, std::ios_base::out); + double x = 0; + stream >> x; + assert(x == 3.25); + } + std::remove(p.c_str()); +} diff --git a/test/std/input.output/file.streams/fstreams/ofstream.members/open_path.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.members/open_path.pass.cpp new file mode 100644 index 000000000..867998bb7 --- /dev/null +++ b/test/std/input.output/file.streams/fstreams/ofstream.members/open_path.pass.cpp @@ -0,0 +1,62 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// + +// plate > +// class basic_ofstream + +// void open(const filesystem::path& s, ios_base::openmode mode = ios_base::out); + +#include +#include +#include +#include "platform_support.h" + +namespace fs = std::filesystem; + +int main() { + fs::path p = get_temp_file_name(); + { + std::ofstream fs; + assert(!fs.is_open()); + char c = 'a'; + fs << c; + assert(fs.fail()); + fs.open(p); + assert(fs.is_open()); + fs << c; + } + { + std::ifstream fs(p.c_str()); + char c = 0; + fs >> c; + assert(c == 'a'); + } + std::remove(p.c_str()); + { + std::wofstream fs; + assert(!fs.is_open()); + wchar_t c = L'a'; + fs << c; + assert(fs.fail()); + fs.open(p); + assert(fs.is_open()); + fs << c; + } + { + std::wifstream fs(p.c_str()); + wchar_t c = 0; + fs >> c; + assert(c == L'a'); + } + std::remove(p.c_str()); +} diff --git a/test/std/experimental/filesystem/Inputs/static_test_env/bad_symlink b/test/std/input.output/filesystems/Inputs/static_test_env/bad_symlink similarity index 100% rename from test/std/experimental/filesystem/Inputs/static_test_env/bad_symlink rename to test/std/input.output/filesystems/Inputs/static_test_env/bad_symlink diff --git a/test/std/experimental/filesystem/Inputs/static_test_env/dir1/dir2/afile3 b/test/std/input.output/filesystems/Inputs/static_test_env/dir1/dir2/afile3 similarity index 100% rename from test/std/experimental/filesystem/Inputs/static_test_env/dir1/dir2/afile3 rename to test/std/input.output/filesystems/Inputs/static_test_env/dir1/dir2/afile3 diff --git a/test/std/experimental/filesystem/Inputs/static_test_env/dir1/dir2/dir3/file5 b/test/std/input.output/filesystems/Inputs/static_test_env/dir1/dir2/dir3/file5 similarity index 100% rename from test/std/experimental/filesystem/Inputs/static_test_env/dir1/dir2/dir3/file5 rename to test/std/input.output/filesystems/Inputs/static_test_env/dir1/dir2/dir3/file5 diff --git a/test/std/experimental/filesystem/Inputs/static_test_env/dir1/dir2/file4 b/test/std/input.output/filesystems/Inputs/static_test_env/dir1/dir2/file4 similarity index 100% rename from test/std/experimental/filesystem/Inputs/static_test_env/dir1/dir2/file4 rename to test/std/input.output/filesystems/Inputs/static_test_env/dir1/dir2/file4 diff --git a/test/std/experimental/filesystem/Inputs/static_test_env/dir1/dir2/symlink_to_dir3 b/test/std/input.output/filesystems/Inputs/static_test_env/dir1/dir2/symlink_to_dir3 similarity index 100% rename from test/std/experimental/filesystem/Inputs/static_test_env/dir1/dir2/symlink_to_dir3 rename to test/std/input.output/filesystems/Inputs/static_test_env/dir1/dir2/symlink_to_dir3 diff --git a/test/std/experimental/filesystem/Inputs/static_test_env/dir1/file1 b/test/std/input.output/filesystems/Inputs/static_test_env/dir1/file1 similarity index 100% rename from test/std/experimental/filesystem/Inputs/static_test_env/dir1/file1 rename to test/std/input.output/filesystems/Inputs/static_test_env/dir1/file1 diff --git a/test/std/experimental/filesystem/Inputs/static_test_env/dir1/file2 b/test/std/input.output/filesystems/Inputs/static_test_env/dir1/file2 similarity index 100% rename from test/std/experimental/filesystem/Inputs/static_test_env/dir1/file2 rename to test/std/input.output/filesystems/Inputs/static_test_env/dir1/file2 diff --git a/test/std/experimental/filesystem/Inputs/static_test_env/empty_file b/test/std/input.output/filesystems/Inputs/static_test_env/empty_file similarity index 100% rename from test/std/experimental/filesystem/Inputs/static_test_env/empty_file rename to test/std/input.output/filesystems/Inputs/static_test_env/empty_file diff --git a/test/std/experimental/filesystem/Inputs/static_test_env/non_empty_file b/test/std/input.output/filesystems/Inputs/static_test_env/non_empty_file similarity index 100% rename from test/std/experimental/filesystem/Inputs/static_test_env/non_empty_file rename to test/std/input.output/filesystems/Inputs/static_test_env/non_empty_file diff --git a/test/std/experimental/filesystem/Inputs/static_test_env/symlink_to_dir b/test/std/input.output/filesystems/Inputs/static_test_env/symlink_to_dir similarity index 100% rename from test/std/experimental/filesystem/Inputs/static_test_env/symlink_to_dir rename to test/std/input.output/filesystems/Inputs/static_test_env/symlink_to_dir diff --git a/test/std/experimental/filesystem/Inputs/static_test_env/symlink_to_empty_file b/test/std/input.output/filesystems/Inputs/static_test_env/symlink_to_empty_file similarity index 100% rename from test/std/experimental/filesystem/Inputs/static_test_env/symlink_to_empty_file rename to test/std/input.output/filesystems/Inputs/static_test_env/symlink_to_empty_file diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons/copy.pass.cpp b/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/copy.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.directory_entry/directory_entry.cons/copy.pass.cpp rename to test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/copy.pass.cpp index f46302938..a81d5ea79 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons/copy.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/copy.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_entry diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons/copy_assign.pass.cpp b/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/copy_assign.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.directory_entry/directory_entry.cons/copy_assign.pass.cpp rename to test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/copy_assign.pass.cpp index 447d40985..204207276 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons/copy_assign.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/copy_assign.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_entry diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons/default.pass.cpp b/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/default.pass.cpp similarity index 96% rename from test/std/experimental/filesystem/class.directory_entry/directory_entry.cons/default.pass.cpp rename to test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/default.pass.cpp index dd4543dbb..1d83cc69d 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons/default.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/default.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_entry diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons/default_const.pass.cpp b/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/default_const.pass.cpp similarity index 96% rename from test/std/experimental/filesystem/class.directory_entry/directory_entry.cons/default_const.pass.cpp rename to test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/default_const.pass.cpp index a94134c15..240541d20 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons/default_const.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/default_const.pass.cpp @@ -10,7 +10,7 @@ // UNSUPPORTED: c++98, c++03 // XFAIL: apple-clang-7, clang-3.7, clang-3.8 -// +// // class directory_entry diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons/move.pass.cpp b/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/move.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.directory_entry/directory_entry.cons/move.pass.cpp rename to test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/move.pass.cpp index f22bf1c33..238a8549e 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons/move.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/move.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_entry diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons/move_assign.pass.cpp b/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/move_assign.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.directory_entry/directory_entry.cons/move_assign.pass.cpp rename to test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/move_assign.pass.cpp index abd9bc865..f104980c9 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons/move_assign.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/move_assign.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_entry diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons/path.pass.cpp b/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/path.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/class.directory_entry/directory_entry.cons/path.pass.cpp rename to test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/path.pass.cpp index b6ecd3f58..b06bd1293 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons/path.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/path.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_entry diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.mods/assign.pass.cpp b/test/std/input.output/filesystems/class.directory_entry/directory_entry.mods/assign.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/class.directory_entry/directory_entry.mods/assign.pass.cpp rename to test/std/input.output/filesystems/class.directory_entry/directory_entry.mods/assign.pass.cpp index 70f0de3fb..d19c8c2ad 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.mods/assign.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_entry/directory_entry.mods/assign.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_entry diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.mods/refresh.pass.cpp b/test/std/input.output/filesystems/class.directory_entry/directory_entry.mods/refresh.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/class.directory_entry/directory_entry.mods/refresh.pass.cpp rename to test/std/input.output/filesystems/class.directory_entry/directory_entry.mods/refresh.pass.cpp index 74c73f030..575f0d59b 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.mods/refresh.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_entry/directory_entry.mods/refresh.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_entry diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.mods/replace_filename.pass.cpp b/test/std/input.output/filesystems/class.directory_entry/directory_entry.mods/replace_filename.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/class.directory_entry/directory_entry.mods/replace_filename.pass.cpp rename to test/std/input.output/filesystems/class.directory_entry/directory_entry.mods/replace_filename.pass.cpp index 24b5ebf07..4a9b76d63 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.mods/replace_filename.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_entry/directory_entry.mods/replace_filename.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_entry diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/comparisons.pass.cpp b/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/comparisons.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/comparisons.pass.cpp rename to test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/comparisons.pass.cpp index 48997ca20..7df36fed3 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/comparisons.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/comparisons.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_entry diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/file_size.pass.cpp b/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/file_size.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/file_size.pass.cpp rename to test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/file_size.pass.cpp index a38b10c00..04dec92c9 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/file_size.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/file_size.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_entry diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/file_type_obs.pass.cpp b/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/file_type_obs.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/file_type_obs.pass.cpp rename to test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/file_type_obs.pass.cpp index a028de4b1..2a0d80ca6 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/file_type_obs.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/file_type_obs.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_entry diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/hard_link_count.pass.cpp b/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/hard_link_count.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/hard_link_count.pass.cpp rename to test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/hard_link_count.pass.cpp index d11457d20..17124c132 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/hard_link_count.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/hard_link_count.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_entry diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/last_write_time.pass.cpp b/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/last_write_time.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/last_write_time.pass.cpp rename to test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/last_write_time.pass.cpp index 3d519728c..afdd47a51 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/last_write_time.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/last_write_time.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_entry diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/path.pass.cpp b/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/path.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/path.pass.cpp rename to test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/path.pass.cpp index 80168ef2a..2abb13df1 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/path.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/path.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_entry diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/status.pass.cpp b/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/status.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/status.pass.cpp rename to test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/status.pass.cpp index 1f15850ce..ec654468b 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/status.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/status.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_entry diff --git a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/symlink_status.pass.cpp b/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/symlink_status.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/symlink_status.pass.cpp rename to test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/symlink_status.pass.cpp index ed6aca2c7..e8850c3a7 100644 --- a/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/symlink_status.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/symlink_status.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_entry diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy.pass.cpp b/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/copy.pass.cpp similarity index 97% rename from test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy.pass.cpp rename to test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/copy.pass.cpp index 777e6144c..ac224ac7a 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/copy.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_iterator diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp b/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp rename to test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp index 067e6c62d..3f08e4024 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_iterator diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp b/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/ctor.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp rename to test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/ctor.pass.cpp index 6a24a52d5..0a33544c5 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/ctor.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_iterator diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/default_ctor.pass.cpp b/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/default_ctor.pass.cpp similarity index 96% rename from test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/default_ctor.pass.cpp rename to test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/default_ctor.pass.cpp index 787f3975e..21c4ed3b7 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/default_ctor.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/default_ctor.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_iterator diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/increment.pass.cpp b/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/increment.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/increment.pass.cpp rename to test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/increment.pass.cpp index ad55e05a7..7ec814b21 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/increment.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/increment.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_iterator diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move.pass.cpp b/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/move.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move.pass.cpp rename to test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/move.pass.cpp index 97a34a9bd..a2bf2ac9f 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/move.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_iterator diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp b/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp rename to test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp index 538256626..1c7224344 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_iterator diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp b/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp rename to test/std/input.output/filesystems/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp index 95bb78c42..71e8e55ae 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_iterator diff --git a/test/std/experimental/filesystem/class.directory_iterator/types.pass.cpp b/test/std/input.output/filesystems/class.directory_iterator/types.pass.cpp similarity index 97% rename from test/std/experimental/filesystem/class.directory_iterator/types.pass.cpp rename to test/std/input.output/filesystems/class.directory_iterator/types.pass.cpp index ca583bedd..4619083e8 100644 --- a/test/std/experimental/filesystem/class.directory_iterator/types.pass.cpp +++ b/test/std/input.output/filesystems/class.directory_iterator/types.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_iterator diff --git a/test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp b/test/std/input.output/filesystems/class.file_status/file_status.cons.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp rename to test/std/input.output/filesystems/class.file_status/file_status.cons.pass.cpp index 4c7d5e337..6676c7b7d 100644 --- a/test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp +++ b/test/std/input.output/filesystems/class.file_status/file_status.cons.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class file_status diff --git a/test/std/experimental/filesystem/class.file_status/file_status.mods.pass.cpp b/test/std/input.output/filesystems/class.file_status/file_status.mods.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.file_status/file_status.mods.pass.cpp rename to test/std/input.output/filesystems/class.file_status/file_status.mods.pass.cpp index 5492ccde7..4cbf2062a 100644 --- a/test/std/experimental/filesystem/class.file_status/file_status.mods.pass.cpp +++ b/test/std/input.output/filesystems/class.file_status/file_status.mods.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class file_status diff --git a/test/std/experimental/filesystem/class.file_status/file_status.obs.pass.cpp b/test/std/input.output/filesystems/class.file_status/file_status.obs.pass.cpp similarity index 97% rename from test/std/experimental/filesystem/class.file_status/file_status.obs.pass.cpp rename to test/std/input.output/filesystems/class.file_status/file_status.obs.pass.cpp index 462670fd8..89739b77d 100644 --- a/test/std/experimental/filesystem/class.file_status/file_status.obs.pass.cpp +++ b/test/std/input.output/filesystems/class.file_status/file_status.obs.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class file_status diff --git a/test/std/experimental/filesystem/class.filesystem_error/filesystem_error.members.pass.cpp b/test/std/input.output/filesystems/class.filesystem_error/filesystem_error.members.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/class.filesystem_error/filesystem_error.members.pass.cpp rename to test/std/input.output/filesystems/class.filesystem_error/filesystem_error.members.pass.cpp index e9b117a79..b7484df5c 100644 --- a/test/std/experimental/filesystem/class.filesystem_error/filesystem_error.members.pass.cpp +++ b/test/std/input.output/filesystems/class.filesystem_error/filesystem_error.members.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class filesystem_error diff --git a/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp b/test/std/input.output/filesystems/class.path/path.itr/iterator.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp rename to test/std/input.output/filesystems/class.path/path.itr/iterator.pass.cpp index 0ea672bdf..b7a0383e0 100644 --- a/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.itr/iterator.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp index 11bc5dd9b..a02ef18c4 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.assign/braced_init.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.assign/braced_init.pass.cpp similarity index 95% rename from test/std/experimental/filesystem/class.path/path.member/path.assign/braced_init.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.assign/braced_init.pass.cpp index bbf331310..fe677c3e6 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.assign/braced_init.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.assign/braced_init.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.assign/copy.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.assign/copy.pass.cpp similarity index 96% rename from test/std/experimental/filesystem/class.path/path.member/path.assign/copy.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.assign/copy.pass.cpp index 8b54be6ed..a0575e649 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.assign/copy.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.assign/copy.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.assign/move.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.assign/move.pass.cpp similarity index 97% rename from test/std/experimental/filesystem/class.path/path.member/path.assign/move.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.assign/move.pass.cpp index c5cb37fac..71fa47d1b 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.assign/move.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.assign/move.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.assign/source.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.assign/source.pass.cpp index 2e064fa48..92eff6e07 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.assign/source.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp index a2af09412..7791097dc 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.concat.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.concat.pass.cpp index 13203d6c6..03d5134fe 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.concat.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.construct/copy.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.construct/copy.pass.cpp similarity index 96% rename from test/std/experimental/filesystem/class.path/path.member/path.construct/copy.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.construct/copy.pass.cpp index 14b4b38c9..69bdb7415 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.construct/copy.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.construct/copy.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.construct/default.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.construct/default.pass.cpp similarity index 95% rename from test/std/experimental/filesystem/class.path/path.member/path.construct/default.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.construct/default.pass.cpp index fddeff989..aa4b03e9b 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.construct/default.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.construct/default.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.construct/move.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.construct/move.pass.cpp similarity index 97% rename from test/std/experimental/filesystem/class.path/path.member/path.construct/move.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.construct/move.pass.cpp index 16f89d0a2..2e8cce228 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.construct/move.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.construct/move.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.construct/source.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.construct/source.pass.cpp index a7c14f3ce..39d63f456 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.construct/source.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.decompose/empty.fail.cpp b/test/std/input.output/filesystems/class.path/path.member/path.decompose/empty.fail.cpp similarity index 96% rename from test/std/experimental/filesystem/class.path/path.member/path.decompose/empty.fail.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.decompose/empty.fail.cpp index ecc4c0c30..1a722d7a2 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.decompose/empty.fail.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.decompose/empty.fail.cpp @@ -8,7 +8,7 @@ // //===----------------------------------------------------------------------===// -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.decompose/path.decompose.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.decompose/path.decompose.pass.cpp index f959e43a3..4eb15cd0b 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.decompose/path.decompose.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.gen/lexically_normal.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_normal.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/class.path/path.member/path.gen/lexically_normal.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_normal.pass.cpp index c897ab60f..3e2fdd08d 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.gen/lexically_normal.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_normal.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp index 8b56a19b7..52c577bc8 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp index a757cbb88..93c49a6ab 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.generic.obs/named_overloads.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.generic.obs/named_overloads.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.path/path.member/path.generic.obs/named_overloads.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.generic.obs/named_overloads.pass.cpp index 56b2787fb..d41ab619a 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.generic.obs/named_overloads.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.generic.obs/named_overloads.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.modifiers/clear.pass.cpp similarity index 96% rename from test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.modifiers/clear.pass.cpp index 1d697571c..fca642647 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.modifiers/clear.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/make_preferred.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.modifiers/make_preferred.pass.cpp similarity index 97% rename from test/std/experimental/filesystem/class.path/path.member/path.modifiers/make_preferred.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.modifiers/make_preferred.pass.cpp index b09806c23..ec914b1bc 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/make_preferred.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.modifiers/make_preferred.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.modifiers/remove_filename.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.modifiers/remove_filename.pass.cpp index ec885f15c..b4019e7f2 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.modifiers/remove_filename.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_extension.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.modifiers/replace_extension.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_extension.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.modifiers/replace_extension.pass.cpp index 2e7d92555..c118b8714 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_extension.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.modifiers/replace_extension.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_filename.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.modifiers/replace_filename.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_filename.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.modifiers/replace_filename.pass.cpp index bfb3b6a19..07cd32772 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/replace_filename.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.modifiers/replace_filename.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/swap.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.modifiers/swap.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.path/path.member/path.modifiers/swap.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.modifiers/swap.pass.cpp index 3aac1ed60..eecfe4252 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/swap.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.modifiers/swap.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.native.obs/c_str.pass.cpp similarity index 97% rename from test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.native.obs/c_str.pass.cpp index f907410a8..e035764d2 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.native.obs/c_str.pass.cpp @@ -10,7 +10,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/named_overloads.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.native.obs/named_overloads.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.path/path.member/path.native.obs/named_overloads.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.native.obs/named_overloads.pass.cpp index 9034ad450..bb0f58cab 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/named_overloads.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.native.obs/named_overloads.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.native.obs/native.pass.cpp similarity index 96% rename from test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.native.obs/native.pass.cpp index 35ea49346..ca02b8680 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.native.obs/native.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.native.obs/operator_string.pass.cpp similarity index 97% rename from test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.native.obs/operator_string.pass.cpp index 9aa1b14c8..4f5f77df4 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.native.obs/operator_string.pass.cpp @@ -10,7 +10,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.native.obs/string_alloc.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.native.obs/string_alloc.pass.cpp index 503c29c32..744ad4df8 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.native.obs/string_alloc.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.member/path.query/tested_in_path_decompose.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.query/tested_in_path_decompose.pass.cpp similarity index 96% rename from test/std/experimental/filesystem/class.path/path.member/path.query/tested_in_path_decompose.pass.cpp rename to test/std/input.output/filesystems/class.path/path.member/path.query/tested_in_path_decompose.pass.cpp index 9cf37d4cd..be662fcb1 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.query/tested_in_path_decompose.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.member/path.query/tested_in_path_decompose.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/append_op.pass.cpp b/test/std/input.output/filesystems/class.path/path.nonmember/append_op.pass.cpp similarity index 96% rename from test/std/experimental/filesystem/class.path/path.nonmember/append_op.pass.cpp rename to test/std/input.output/filesystems/class.path/path.nonmember/append_op.pass.cpp index 3648da57a..09498bf21 100644 --- a/test/std/experimental/filesystem/class.path/path.nonmember/append_op.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.nonmember/append_op.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // path operator/(path const&, path const&); diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/comparison_ops_tested_elsewhere.pass.cpp b/test/std/input.output/filesystems/class.path/path.nonmember/comparison_ops_tested_elsewhere.pass.cpp similarity index 100% rename from test/std/experimental/filesystem/class.path/path.nonmember/comparison_ops_tested_elsewhere.pass.cpp rename to test/std/input.output/filesystems/class.path/path.nonmember/comparison_ops_tested_elsewhere.pass.cpp diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/hash_value_tested_elswhere.pass.cpp b/test/std/input.output/filesystems/class.path/path.nonmember/hash_value_tested_elswhere.pass.cpp similarity index 100% rename from test/std/experimental/filesystem/class.path/path.nonmember/hash_value_tested_elswhere.pass.cpp rename to test/std/input.output/filesystems/class.path/path.nonmember/hash_value_tested_elswhere.pass.cpp diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/path.factory.pass.cpp b/test/std/input.output/filesystems/class.path/path.nonmember/path.factory.pass.cpp similarity index 97% rename from test/std/experimental/filesystem/class.path/path.nonmember/path.factory.pass.cpp rename to test/std/input.output/filesystems/class.path/path.nonmember/path.factory.pass.cpp index 5d9194b4e..96b8286d5 100644 --- a/test/std/experimental/filesystem/class.path/path.nonmember/path.factory.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.nonmember/path.factory.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // template // path u8path(Source const&); diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp b/test/std/input.output/filesystems/class.path/path.nonmember/path.io.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp rename to test/std/input.output/filesystems/class.path/path.nonmember/path.io.pass.cpp index 58e333aad..7902289ed 100644 --- a/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.nonmember/path.io.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/path.io.unicode_bug.pass.cpp b/test/std/input.output/filesystems/class.path/path.nonmember/path.io.unicode_bug.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.path/path.nonmember/path.io.unicode_bug.pass.cpp rename to test/std/input.output/filesystems/class.path/path.nonmember/path.io.unicode_bug.pass.cpp index ff622532e..65be19fdc 100644 --- a/test/std/experimental/filesystem/class.path/path.nonmember/path.io.unicode_bug.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.nonmember/path.io.unicode_bug.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/swap.pass.cpp b/test/std/input.output/filesystems/class.path/path.nonmember/swap.pass.cpp similarity index 97% rename from test/std/experimental/filesystem/class.path/path.nonmember/swap.pass.cpp rename to test/std/input.output/filesystems/class.path/path.nonmember/swap.pass.cpp index 4f7b93a05..554b5129c 100644 --- a/test/std/experimental/filesystem/class.path/path.nonmember/swap.pass.cpp +++ b/test/std/input.output/filesystems/class.path/path.nonmember/swap.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // void swap(path& lhs, path& rhs) noexcept; diff --git a/test/std/experimental/filesystem/class.path/synop.pass.cpp b/test/std/input.output/filesystems/class.path/synop.pass.cpp similarity index 97% rename from test/std/experimental/filesystem/class.path/synop.pass.cpp rename to test/std/input.output/filesystems/class.path/synop.pass.cpp index 3ed0a8f19..875f92fb6 100644 --- a/test/std/experimental/filesystem/class.path/synop.pass.cpp +++ b/test/std/input.output/filesystems/class.path/synop.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp b/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp rename to test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp index 15cf50569..40ce491b7 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp +++ b/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class recursive_directory_iterator diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp b/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp rename to test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp index ebe4c87d0..00c8c35fc 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp +++ b/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class recursive_directory_iterator diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp b/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp rename to test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp index 29a86258d..e02d6679c 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp +++ b/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class directory_iterator diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp b/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp rename to test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp index d27194abe..9b239c6bf 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp +++ b/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class recursive_directory_iterator diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp b/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp similarity index 97% rename from test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp rename to test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp index e385624bc..799494f1b 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp +++ b/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class recursive_directory_iterator diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp b/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp rename to test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp index ad6151881..bfc818924 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp +++ b/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class recursive_directory_iterator diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp b/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp rename to test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp index 6fe26d5ed..e258c45e3 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp +++ b/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class recursive_directory_iterator diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp b/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp rename to test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp index fc6d05cb0..61bb8724b 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp +++ b/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class recursive_directory_iterator diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp b/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp rename to test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp index 39e0f4f57..fe6ce5ff3 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp +++ b/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class recursive_directory_iterator diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp b/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp rename to test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp index 36453a279..662c11446 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp +++ b/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class recursive_directory_iterator diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp b/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp rename to test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp index 8d9f14dfe..04bc2dd1d 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp +++ b/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class recursive_directory_iterator diff --git a/test/std/experimental/filesystem/fs.enum/check_bitmask_types.hpp b/test/std/input.output/filesystems/fs.enum/check_bitmask_types.hpp similarity index 100% rename from test/std/experimental/filesystem/fs.enum/check_bitmask_types.hpp rename to test/std/input.output/filesystems/fs.enum/check_bitmask_types.hpp diff --git a/test/std/experimental/filesystem/fs.enum/enum.copy_options.pass.cpp b/test/std/input.output/filesystems/fs.enum/enum.copy_options.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/fs.enum/enum.copy_options.pass.cpp rename to test/std/input.output/filesystems/fs.enum/enum.copy_options.pass.cpp index 4e3a33ce3..75477309f 100644 --- a/test/std/experimental/filesystem/fs.enum/enum.copy_options.pass.cpp +++ b/test/std/input.output/filesystems/fs.enum/enum.copy_options.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // enum class copy_options; diff --git a/test/std/experimental/filesystem/fs.enum/enum.directory_options.pass.cpp b/test/std/input.output/filesystems/fs.enum/enum.directory_options.pass.cpp similarity index 97% rename from test/std/experimental/filesystem/fs.enum/enum.directory_options.pass.cpp rename to test/std/input.output/filesystems/fs.enum/enum.directory_options.pass.cpp index d866c0b45..db40f6de9 100644 --- a/test/std/experimental/filesystem/fs.enum/enum.directory_options.pass.cpp +++ b/test/std/input.output/filesystems/fs.enum/enum.directory_options.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // enum class directory_options; diff --git a/test/std/experimental/filesystem/fs.enum/enum.file_type.pass.cpp b/test/std/input.output/filesystems/fs.enum/enum.file_type.pass.cpp similarity index 97% rename from test/std/experimental/filesystem/fs.enum/enum.file_type.pass.cpp rename to test/std/input.output/filesystems/fs.enum/enum.file_type.pass.cpp index 6b6e069ff..899ab6820 100644 --- a/test/std/experimental/filesystem/fs.enum/enum.file_type.pass.cpp +++ b/test/std/input.output/filesystems/fs.enum/enum.file_type.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // enum class file_type; diff --git a/test/std/experimental/filesystem/fs.enum/enum.path.format.pass.cpp b/test/std/input.output/filesystems/fs.enum/enum.path.format.pass.cpp similarity index 97% rename from test/std/experimental/filesystem/fs.enum/enum.path.format.pass.cpp rename to test/std/input.output/filesystems/fs.enum/enum.path.format.pass.cpp index 51e3f86ea..d4ec48e84 100644 --- a/test/std/experimental/filesystem/fs.enum/enum.path.format.pass.cpp +++ b/test/std/input.output/filesystems/fs.enum/enum.path.format.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path; // enum class format; diff --git a/test/std/experimental/filesystem/fs.enum/enum.perm_options.pass.cpp b/test/std/input.output/filesystems/fs.enum/enum.perm_options.pass.cpp similarity index 97% rename from test/std/experimental/filesystem/fs.enum/enum.perm_options.pass.cpp rename to test/std/input.output/filesystems/fs.enum/enum.perm_options.pass.cpp index c1066b63b..5af504530 100644 --- a/test/std/experimental/filesystem/fs.enum/enum.perm_options.pass.cpp +++ b/test/std/input.output/filesystems/fs.enum/enum.perm_options.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // enum class perm_options; diff --git a/test/std/experimental/filesystem/fs.enum/enum.perms.pass.cpp b/test/std/input.output/filesystems/fs.enum/enum.perms.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/fs.enum/enum.perms.pass.cpp rename to test/std/input.output/filesystems/fs.enum/enum.perms.pass.cpp index 7cd8f6779..9f2e4e214 100644 --- a/test/std/experimental/filesystem/fs.enum/enum.perms.pass.cpp +++ b/test/std/input.output/filesystems/fs.enum/enum.perms.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // enum class perms; diff --git a/test/std/experimental/filesystem/fs.error.report/tested_elsewhere.pass.cpp b/test/std/input.output/filesystems/fs.error.report/tested_elsewhere.pass.cpp similarity index 100% rename from test/std/experimental/filesystem/fs.error.report/tested_elsewhere.pass.cpp rename to test/std/input.output/filesystems/fs.error.report/tested_elsewhere.pass.cpp diff --git a/test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp b/test/std/input.output/filesystems/fs.filesystem.synopsis/file_time_type.pass.cpp similarity index 97% rename from test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp rename to test/std/input.output/filesystems/fs.filesystem.synopsis/file_time_type.pass.cpp index 1c25450da..157083a30 100644 --- a/test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp +++ b/test/std/input.output/filesystems/fs.filesystem.synopsis/file_time_type.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // typedef TrivialClock file_time_type; diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.absolute/absolute.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.absolute/absolute.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.absolute/absolute.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.absolute/absolute.pass.cpp index 9b73aedc8..b2a5794a5 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.absolute/absolute.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.absolute/absolute.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // path absolute(const path& p, const path& base=current_path()); diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.canonical/canonical.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.canonical/canonical.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.canonical/canonical.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.canonical/canonical.pass.cpp index c9c9128aa..eb10d9816 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.canonical/canonical.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.canonical/canonical.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // path canonical(const path& p); // path canonical(const path& p, error_code& ec); diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy/copy.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.copy/copy.pass.cpp index ce853b636..ba579d0af 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy/copy.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // void copy(const path& from, const path& to); // void copy(const path& from, const path& to, error_code& ec); diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp index 5f023743a..a67b431fb 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // bool copy_file(const path& from, const path& to); // bool copy_file(const path& from, const path& to, error_code& ec) noexcept; diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file_large.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file_large.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file_large.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file_large.pass.cpp index 46b5f2a67..61733d526 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file_large.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file_large.pass.cpp @@ -10,7 +10,7 @@ // UNSUPPORTED: c++98, c++03 // REQUIRES: long_tests -// +// // bool copy_file(const path& from, const path& to); // bool copy_file(const path& from, const path& to, error_code& ec) noexcept; diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp index 2530bc9b6..ee4a9ed4b 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // void copy_symlink(const path& existing_symlink, const path& new_symlink); // void copy_symlink(const path& existing_symlink, const path& new_symlink, diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp index 8afc6102e..6b651dfb0 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // bool create_directories(const path& p); // bool create_directories(const path& p, error_code& ec) noexcept; diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp index 7885c4a54..e73e21ffb 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // bool create_directory(const path& p); // bool create_directory(const path& p, error_code& ec) noexcept; diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp index 2ee55fc4c..f013bbb20 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // bool create_directory(const path& p, const path& attr); // bool create_directory(const path& p, const path& attr, error_code& ec) noexcept; diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp index e7cba97dd..f1d9ff041 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // void create_directory_symlink(const path& existing_symlink, const path& new_symlink); // void create_directory_symlink(const path& existing_symlink, const path& new_symlink, diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp index 7dbc705f4..f1ffc74c2 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // void create_hard_link(const path& existing_symlink, const path& new_symlink); // void create_hard_link(const path& existing_symlink, const path& new_symlink, diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp index 46519ad77..e69aae186 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // void create_symlink(const path& existing_symlink, const path& new_symlink); // void create_symlink(const path& existing_symlink, const path& new_symlink, diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.current_path/current_path.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.current_path/current_path.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.current_path/current_path.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.current_path/current_path.pass.cpp index 82ba91c0f..dd3736e08 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.current_path/current_path.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.current_path/current_path.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // path current_path(); // path current_path(error_code& ec); diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp index 3381f64d5..392f66c6d 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // bool equivalent(path const& lhs, path const& rhs); // bool equivalent(path const& lhs, path const& rhs, std::error_code& ec) noexcept; diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.exists/exists.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.exists/exists.pass.cpp index 4b6ed9642..916052b74 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.exists/exists.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // bool exists(file_status s) noexcept // bool exists(path const& p); diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.file_size/file_size.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.file_size/file_size.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.file_size/file_size.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.file_size/file_size.pass.cpp index c79012d9e..60e0042cf 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.file_size/file_size.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.file_size/file_size.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // uintmax_t file_size(const path& p); // uintmax_t file_size(const path& p, std::error_code& ec) noexcept; diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp index f90e3f772..2e9704a3d 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // uintmax_t hard_link_count(const path& p); // uintmax_t hard_link_count(const path& p, std::error_code& ec) noexcept; diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp index c27565e5f..36f1d6bbd 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // bool is_block_file(file_status s) noexcept // bool is_block_file(path const& p); diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp index 546881920..b0c3fe542 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // bool is_character_file(file_status s) noexcept // bool is_character_file(path const& p); diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp index 3270fcc80..bb578b9cf 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // bool is_directory(file_status s) noexcept // bool is_directory(path const& p); diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp index ffe60a823..cd4dd1748 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // bool is_empty(path const& p); // bool is_empty(path const& p, std::error_code& ec); diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp index 9c56f7356..3c86dc0e7 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // bool is_fifo(file_status s) noexcept // bool is_fifo(path const& p); diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_other/is_other.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_other/is_other.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.is_other/is_other.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.is_other/is_other.pass.cpp index d01268a73..a2134c7c1 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_other/is_other.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_other/is_other.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // bool is_other(file_status s) noexcept // bool is_other(path const& p); diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp index 96e027d2c..0c3488635 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // bool is_regular_file(file_status s) noexcept // bool is_regular_file(path const& p); diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp index 1593d6a3b..7273c6c2e 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // bool is_socket(file_status s) noexcept // bool is_socket(path const& p); diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp index 97cd0a3d0..e1ac98a80 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // bool is_symlink(file_status s) noexcept // bool is_symlink(path const& p); diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp index 616264d3d..bc77f3f63 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // file_time_type last_write_time(const path& p); // file_time_type last_write_time(const path& p, std::error_code& ec) noexcept; diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.permissions/permissions.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.permissions/permissions.pass.cpp index 65d8d7164..cbe2b2d09 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.permissions/permissions.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // void permissions(const path& p, perms prms, // perm_options opts = perm_options::replace); diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.proximate/proximate.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.proximate/proximate.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp index dc89228a7..5f7b30dd6 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.proximate/proximate.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // path proximate(const path& p, error_code &ec) // path proximate(const path& p, const path& base = current_path()) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp index 8011da343..43dfec834 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // path read_symlink(const path& p); // path read_symlink(const path& p, error_code& ec); diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.relative/relative.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.relative/relative.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.relative/relative.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.relative/relative.pass.cpp index 62bc32a73..e240c6496 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.relative/relative.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.relative/relative.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // path proximate(const path& p, error_code &ec) // path proximate(const path& p, const path& base = current_path()) diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove/remove.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove/remove.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.remove/remove.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.remove/remove.pass.cpp index 2b5f52c75..37b47f151 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove/remove.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove/remove.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // bool remove(const path& p); // bool remove(const path& p, error_code& ec) noexcept; diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp index 99935f44b..0f015c387 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // uintmax_t remove_all(const path& p); // uintmax_t remove_all(const path& p, error_code& ec) noexcept; diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.rename/rename.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.rename/rename.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.rename/rename.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.rename/rename.pass.cpp index f20d73fcc..e2ebdc61f 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.rename/rename.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.rename/rename.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // void rename(const path& old_p, const path& new_p); // void rename(const path& old_p, const path& new_p, error_code& ec) noexcept; diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp index 38596cd4c..1a2df47e6 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // void resize_file(const path& p, uintmax_t new_size); // void resize_file(const path& p, uintmax_t new_size, error_code& ec) noexcept; diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.space/space.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.space/space.pass.cpp index 4f617cd66..2c2e75af6 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.space/space.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // space_info space(const path& p); // space_info space(const path& p, error_code& ec) noexcept; diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.status/status.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.status/status.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.status/status.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.status/status.pass.cpp index 997f318f7..ab72f2e5d 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.status/status.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.status/status.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // file_status status(const path& p); // file_status status(const path& p, error_code& ec) noexcept; diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.status_known/status_known.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.status_known/status_known.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.status_known/status_known.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.status_known/status_known.pass.cpp index ed6733fb6..d74ced643 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.status_known/status_known.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.status_known/status_known.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // bool status_known(file_status s) noexcept; diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp index 9db83fbc3..fac630da1 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // file_status symlink_status(const path& p); // file_status symlink_status(const path& p, error_code& ec) noexcept; diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp similarity index 99% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp index 1942bd8b4..523e429cf 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // path temp_directory_path(); // path temp_directory_path(error_code& ec); diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp similarity index 98% rename from test/std/experimental/filesystem/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp rename to test/std/input.output/filesystems/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp index b4cb81d5b..0fe058ffd 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp +++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // path weakly_canonical(const path& p); // path weakly_canonical(const path& p, error_code& ec); diff --git a/test/std/input.output/filesystems/fs.req.macros/feature_macro.pass.cpp b/test/std/input.output/filesystems/fs.req.macros/feature_macro.pass.cpp new file mode 100644 index 000000000..071fa800c --- /dev/null +++ b/test/std/input.output/filesystems/fs.req.macros/feature_macro.pass.cpp @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// #define __cpp_lib_filesystem 201703L + +#include +#include "test_macros.h" + +#if TEST_STD_VER >= 17 +#ifndef __cpp_lib_filesystem +#error Filesystem feature test macro is not defined (__cpp_lib_filesystem) +#elif __cpp_lib_filesystem != 201703L +#error Filesystem feature test macro has an incorrect value (__cpp_lib_filesystem) +#endif +#else // TEST_STD_VER < 17 +#ifdef __cpp_lib_filesystem +#error Filesystem feature test macro should not be defined before C++17 +#endif +#endif + +int main() { } diff --git a/test/std/input.output/filesystems/fs.req.namespace/namespace.fail.cpp b/test/std/input.output/filesystems/fs.req.namespace/namespace.fail.cpp new file mode 100644 index 000000000..c61bb2e12 --- /dev/null +++ b/test/std/input.output/filesystems/fs.req.namespace/namespace.fail.cpp @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// REQUIRES: c++98 || c++03 || c++11 || c++14 + +// + +// namespace std::filesystem + +#include +#include "test_macros.h" + +using namespace std::filesystem; + +#if TEST_STD_VER >= 11 +// expected-error@-3 {{no namespace named 'filesystem' in namespace 'std';}} +#else +// expected-error@-5 {{expected namespace name}} +#endif + +int main() { + +} diff --git a/test/std/input.output/filesystems/fs.req.namespace/namespace.pass.cpp b/test/std/input.output/filesystems/fs.req.namespace/namespace.pass.cpp new file mode 100644 index 000000000..557de3488 --- /dev/null +++ b/test/std/input.output/filesystems/fs.req.namespace/namespace.pass.cpp @@ -0,0 +1,26 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// + +// namespace std::filesystem + +#include +#include + +using namespace std::filesystem; + +int main() { + static_assert(std::is_same< + path, + std::filesystem::path + >::value, ""); +} diff --git a/test/std/experimental/filesystem/lit.local.cfg b/test/std/input.output/filesystems/lit.local.cfg similarity index 100% rename from test/std/experimental/filesystem/lit.local.cfg rename to test/std/input.output/filesystems/lit.local.cfg diff --git a/test/support/filesystem_include.hpp b/test/support/filesystem_include.hpp index 228e710f3..731532a7b 100644 --- a/test/support/filesystem_include.hpp +++ b/test/support/filesystem_include.hpp @@ -1,18 +1,13 @@ #ifndef TEST_SUPPORT_FILESYSTEM_INCLUDE_HPP #define TEST_SUPPORT_FILESYSTEM_INCLUDE_HPP -#include -// Test against std::filesystem for STL's other than libc++ -#ifndef _LIBCPP_VERSION -#define TEST_INCLUDE_STD_FILESYSTEM -#endif - -#ifdef TEST_INCLUDE_STD_FILESYSTEM #include -namespace fs = std::filesystem; +#include "test_macros.h" + +#if defined(_LIBCPP_VERSION) && TEST_STD_VER < 17 +namespace fs = std::__fs::filesystem; #else -#include -namespace fs = std::experimental::filesystem; +namespace fs = std::filesystem; #endif #endif diff --git a/utils/libcxx/test/config.py b/utils/libcxx/test/config.py index 34753be84..6542ceb6f 100644 --- a/utils/libcxx/test/config.py +++ b/utils/libcxx/test/config.py @@ -720,13 +720,9 @@ class Configuration(object): enable_fs = self.get_lit_bool('enable_filesystem', default=False) if not enable_fs: return - enable_experimental = self.get_lit_bool('enable_experimental', default=False) - if not enable_experimental: - self.lit_config.fatal( - 'filesystem is enabled but libc++experimental.a is not.') self.config.available_features.add('c++filesystem') static_env = os.path.join(self.libcxx_src_root, 'test', 'std', - 'experimental', 'filesystem', 'Inputs', 'static_test_env') + 'input.output', 'filesystems', 'Inputs', 'static_test_env') static_env = os.path.realpath(static_env) assert os.path.isdir(static_env) self.cxx.compile_flags += ['-DLIBCXX_FILESYSTEM_STATIC_TEST_ROOT="%s"' % static_env] @@ -821,6 +817,10 @@ class Configuration(object): if libcxx_experimental: self.config.available_features.add('c++experimental') self.cxx.link_flags += ['-lc++experimental'] + libcxx_fs = self.get_lit_bool('enable_filesystem', default=False) + if libcxx_fs: + self.config.available_features.add('c++fs') + self.cxx.link_flags += ['-lc++fs'] if self.link_shared: self.cxx.link_flags += ['-lc++'] else: diff --git a/www/cxx1z_status.html b/www/cxx1z_status.html index 3d826acf3..de8caa87f 100644 --- a/www/cxx1z_status.html +++ b/www/cxx1z_status.html @@ -83,7 +83,7 @@ P0024R2LWGThe Parallelism TS Should be StandardizedJacksonville P0226R1LWGMathematical Special Functions for C++17Jacksonville - P0220R1LWGAdopt Library Fundamentals V1 TS Components for C++17JacksonvilleIn Progress + P0220R1LWGAdopt Library Fundamentals V1 TS Components for C++17JacksonvilleComplete7.0 P0218R1LWGAdopt the File System TS for C++17JacksonvilleIn Progress P0033R1LWGRe-enabling shared_from_thisJacksonvilleComplete3.9 P0005R4LWGAdopt not_fn from Library Fundamentals 2 for C++17JacksonvilleComplete3.9 @@ -443,7 +443,7 @@ 2778basic_string_view is missing constexprIssaquahComplete 2260Missing requirement for Allocator::pointerKona - 2676Provide filesystem::path overloads for File-based streamsKona + 2676Provide filesystem::path overloads for File-based streamsKonaComplete 2768any_cast and move semanticsKonaComplete 2769Redundant const in the return type of any_cast(const any&)KonaComplete 2781Contradictory requirements for std::function and std::reference_wrapperKonaComplete