summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2018-07-27 03:07:09 +0000
committerEric Fiselier <eric@efcs.ca>2018-07-27 03:07:09 +0000
commit998a5c88312066fcc2b2de1358edc76587611354 (patch)
treef3e74cc7ce9e55f30e7019dd6e379571c91aaa1f /libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis
parent567485a72ff71e34c9e25aaab8eecfda3aa6cd62 (diff)
downloadbcm5719-llvm-998a5c88312066fcc2b2de1358edc76587611354.tar.gz
bcm5719-llvm-998a5c88312066fcc2b2de1358edc76587611354.zip
Implement <filesystem>
This patch implements the <filesystem> header and uses that to provide <experimental/filesystem>. Unlike other standard headers, the symbols needed for <filesystem> have not yet been placed in libc++.so. Instead they live in the new libc++fs.a library. Users of filesystem are required to link this library. (Also note that libc++experimental no longer contains the definition of <experimental/filesystem>, which now requires linking libc++fs). The reason for keeping <filesystem> out of the dylib for now is that it's still somewhat experimental, and the possibility of requiring an ABI breaking change is very real. In the future the symbols will likely be moved into the dylib, or the dylib will be made to link libc++fs automagically). Note that moving the symbols out of libc++experimental may break user builds until they update to -lc++fs. This should be OK, because the experimental library provides no stability guarantees. However, I plan on looking into ways we can force libc++experimental to automagically link libc++fs. In order to use a single implementation and set of tests for <filesystem>, it has been placed in a special `__fs` namespace. This namespace is inline in C++17 onward, but not before that. As such implementation is available in C++11 onward, but no filesystem namespace is present "directly", and as such name conflicts shouldn't occur in C++11 or C++14. llvm-svn: 338093
Diffstat (limited to 'libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis')
-rw-r--r--libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/file_time_type.pass.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/file_time_type.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/file_time_type.pass.cpp
new file mode 100644
index 00000000000..157083a3094
--- /dev/null
+++ b/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/file_time_type.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// <filesystem>
+
+// typedef TrivialClock file_time_type;
+
+#include "filesystem_include.hpp"
+#include <chrono>
+#include <type_traits>
+
+#include "test_macros.h"
+
+// system_clock is used because it meets the requirements of TrivialClock,
+// and the resolution and range of system_clock should match the operating
+// system's file time type.
+
+void test_trivial_clock() {
+ using namespace fs;
+ using Clock = file_time_type::clock;
+ ASSERT_NOEXCEPT(Clock::now());
+ ASSERT_SAME_TYPE(decltype(Clock::now()), file_time_type);
+ ASSERT_SAME_TYPE(Clock::time_point, file_time_type);
+ volatile auto* odr_use = &Clock::is_steady;
+ ((void)odr_use);
+}
+
+void test_time_point_resolution_and_range() {
+ using namespace fs;
+ using Dur = file_time_type::duration;
+ using Period = Dur::period;
+ ASSERT_SAME_TYPE(Period, std::nano);
+}
+
+int main() {
+ test_trivial_clock();
+ test_time_point_resolution_and_range();
+}
OpenPOWER on IntegriCloud