[libcxx-commits] [PATCH] D158862: [libc++][C++20 modules] Tests no except build.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Aug 25 10:08:54 PDT 2023


Mordante created this revision.
Herald added a subscriber: arichardson.
Herald added a project: All.
Mordante requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

Depends on D158661 <https://reviews.llvm.org/D158661>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158862

Files:
  libcxx/cmake/caches/Generic-no-exceptions.cmake
  libcxx/docs/Modules.rst
  libcxx/modules/CMakeLists.txt.in
  libcxx/utils/ci/buildkite-pipeline.yml


Index: libcxx/utils/ci/buildkite-pipeline.yml
===================================================================
--- libcxx/utils/ci/buildkite-pipeline.yml
+++ libcxx/utils/ci/buildkite-pipeline.yml
@@ -705,8 +705,11 @@
         - "**/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"
Index: libcxx/modules/CMakeLists.txt.in
===================================================================
--- libcxx/modules/CMakeLists.txt.in
+++ libcxx/modules/CMakeLists.txt.in
@@ -29,10 +29,6 @@
   endif()
 endmacro()
 
-if(NOT @LIBCXX_ENABLE_EXCEPTIONS@ OR NOT @LIBCXXABI_ENABLE_EXCEPTIONS@)
-  message(FATAL_ERROR "Modules without exception support is not yet implemented.")
-endif()
-
 add_library(std)
 target_sources(std
   PUBLIC FILE_SET cxx_modules TYPE CXX_MODULES FILES
@@ -42,6 +38,10 @@
 target_compile_definitions(std PRIVATE _LIBCPP_ENABLE_EXPERIMENTAL)
 target_include_directories(std SYSTEM PRIVATE @LIBCXX_CONFIGURED_INCLUDE_DIR@)
 
+if (NOT @LIBCXX_ENABLE_EXCEPTIONS@)
+  target_compile_options(std PUBLIC -fno-exceptions)
+endif()
+
 target_compile_options(std
   PUBLIC
     -nostdinc++
Index: libcxx/docs/Modules.rst
===================================================================
--- libcxx/docs/Modules.rst
+++ libcxx/docs/Modules.rst
@@ -48,9 +48,15 @@
    * ``LIBCXX_ENABLE_FILESYSTEM``
    * ``LIBCXX_ENABLE_RANDOM_DEVICE``
    * ``LIBCXX_ENABLE_UNICODE``
+   * ``LIBCXX_ENABLE_EXCEPTIONS`` [#note-no-windows]_
 
  * A C++20 based extension
 
+.. note::
+
+   .. [#note-no-windows] This configuration will probably not work on Windows
+                         due to hard-coded compilation flags.
+
 Some of the current limitations
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
Index: libcxx/cmake/caches/Generic-no-exceptions.cmake
===================================================================
--- libcxx/cmake/caches/Generic-no-exceptions.cmake
+++ libcxx/cmake/caches/Generic-no-exceptions.cmake
@@ -1,2 +1,3 @@
+set(LIBCXX_ENABLE_STD_MODULES ON CACHE BOOL "") # TODO MODULES Remove when enabled automatically.
 set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
 set(LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158862.553525.patch
Type: text/x-patch
Size: 2612 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230825/9c947d38/attachment-0001.bin>


More information about the libcxx-commits mailing list