[libcxx-commits] [libcxx] c9c71a7 - [libc++][C++20 modules] Tests no filesystem build.

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Tue Aug 22 11:16:06 PDT 2023


Author: Mark de Wever
Date: 2023-08-22T20:15:59+02:00
New Revision: c9c71a7e0b37c81ba10bdddbcf6326a02281b13f

URL: https://github.com/llvm/llvm-project/commit/c9c71a7e0b37c81ba10bdddbcf6326a02281b13f
DIFF: https://github.com/llvm/llvm-project/commit/c9c71a7e0b37c81ba10bdddbcf6326a02281b13f.diff

LOG: [libc++][C++20 modules] Tests no filesystem build.

Depends on D158331

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D158337

Added: 
    

Modified: 
    libcxx/cmake/caches/Generic-no-filesystem.cmake
    libcxx/docs/Modules.rst
    libcxx/modules/CMakeLists.txt.in
    libcxx/modules/std/filesystem.inc
    libcxx/modules/std/fstream.inc
    libcxx/utils/ci/buildkite-pipeline.yml

Removed: 
    


################################################################################
diff  --git a/libcxx/cmake/caches/Generic-no-filesystem.cmake b/libcxx/cmake/caches/Generic-no-filesystem.cmake
index 4000f3a3e8ef23..db62f86854d941 100644
--- a/libcxx/cmake/caches/Generic-no-filesystem.cmake
+++ b/libcxx/cmake/caches/Generic-no-filesystem.cmake
@@ -1 +1,2 @@
+set(LIBCXX_ENABLE_STD_MODULES ON CACHE BOOL "") # TODO MODULES Remove when enabled automatically.
 set(LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")

diff  --git a/libcxx/docs/Modules.rst b/libcxx/docs/Modules.rst
index cba8d7876cde51..37e1161f0716f3 100644
--- a/libcxx/docs/Modules.rst
+++ b/libcxx/docs/Modules.rst
@@ -45,6 +45,7 @@ What works
    * ``LIBCXX_ENABLE_LOCALIZATION``
    * ``LIBCXX_ENABLE_WIDE_CHARACTERS``
    * ``LIBCXX_ENABLE_THREADS``
+   * ``LIBCXX_ENABLE_FILESYSTEM``
 
 Some of the current limitations
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

diff  --git a/libcxx/modules/CMakeLists.txt.in b/libcxx/modules/CMakeLists.txt.in
index a3ba3454cfc659..18e7a7ae53763e 100644
--- a/libcxx/modules/CMakeLists.txt.in
+++ b/libcxx/modules/CMakeLists.txt.in
@@ -29,9 +29,6 @@ macro(compile_define_if condition def)
   endif()
 endmacro()
 
-if(NOT @LIBCXX_ENABLE_FILESYSTEM@)
-  message(FATAL_ERROR "Modules without filesystem support is not yet implemented.")
-endif()
 if(NOT @LIBCXX_ENABLE_RANDOM_DEVICE@)
   message(FATAL_ERROR "Modules without randome device support is not yet implemented.")
 endif()

diff  --git a/libcxx/modules/std/filesystem.inc b/libcxx/modules/std/filesystem.inc
index 565705cfb4eb8c..3214b49fe8d823 100644
--- a/libcxx/modules/std/filesystem.inc
+++ b/libcxx/modules/std/filesystem.inc
@@ -18,6 +18,7 @@ export namespace std::filesystem {
   // [fs.class.filesystem.error], filesystem errors
   using std::filesystem::filesystem_error;
 
+#ifndef _LIBCPP_HAS_NO_FILESYSTEM
   // [fs.class.directory.entry], directory entries
   using std::filesystem::directory_entry;
 
@@ -30,6 +31,7 @@ export namespace std::filesystem {
 
   // [fs.class.rec.dir.itr], recursive directory iterators
   using std::filesystem::recursive_directory_iterator;
+#endif // _LIBCPP_HAS_NO_FILESYSTEM
 
   // [fs.rec.dir.itr.nonmembers], range access for recursive directory iterators
 
@@ -56,6 +58,7 @@ export namespace std::filesystem {
   using std::filesystem::operator|=;
   using std::filesystem::operator~;
 
+#ifndef _LIBCPP_HAS_NO_FILESYSTEM
   // [fs.op.funcs], filesystem operations
   using std::filesystem::absolute;
   using std::filesystem::canonical;
@@ -99,10 +102,10 @@ export namespace std::filesystem {
   using std::filesystem::symlink_status;
   using std::filesystem::temp_directory_path;
   using std::filesystem::weakly_canonical;
+#endif // _LIBCPP_HAS_NO_FILESYSTEM
 
   // [depr.fs.path.factory]
   using std::filesystem::u8path;
-
 } // namespace std::filesystem
 
 // [fs.path.hash], hash support
@@ -111,6 +114,8 @@ export namespace std {
 }
 
 export namespace std::ranges {
+#ifndef _LIBCPP_HAS_NO_FILESYSTEM
   using std::ranges::enable_borrowed_range;
   using std::ranges::enable_view;
+#endif // _LIBCPP_HAS_NO_FILESYSTEM
 } // namespace std::ranges

diff  --git a/libcxx/modules/std/fstream.inc b/libcxx/modules/std/fstream.inc
index 4b6abf658db2e9..b0017949af5403 100644
--- a/libcxx/modules/std/fstream.inc
+++ b/libcxx/modules/std/fstream.inc
@@ -11,7 +11,9 @@ export namespace std {
 #ifndef _LIBCPP_HAS_NO_LOCALIZATION
   using std::basic_filebuf;
 
+#  ifndef _LIBCPP_HAS_NO_FILESYSTEM
   using std::swap;
+#  endif
 
   using std::filebuf;
 #  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS

diff  --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml
index 2b6cd6e222a0fe..9aa881c0f5bba5 100644
--- a/libcxx/utils/ci/buildkite-pipeline.yml
+++ b/libcxx/utils/ci/buildkite-pipeline.yml
@@ -590,8 +590,11 @@ steps:
         - "**/test-results.xml"
         - "**/*.abilist"
       env:
-          CC: "clang-${LLVM_HEAD_VERSION}"
-          CXX: "clang++-${LLVM_HEAD_VERSION}"
+          # Note: Modules require and absolute path for clang-scan-deps
+          # https://github.com/llvm/llvm-project/issues/61006
+          CC: "/usr/lib/llvm-${LLVM_HEAD_VERSION}/bin/clang"
+          CXX: "/usr/lib/llvm-${LLVM_HEAD_VERSION}/bin/clang++"
+          CMAKE: "/opt/bin/cmake"
           ENABLE_CLANG_TIDY: "On"
       agents:
         queue: "libcxx-builders"


        


More information about the libcxx-commits mailing list