[libcxx-commits] [libcxx] ed1273d - [libc++] change the visibility of libc++ header to public in libcxx module (#91240)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 25 07:57:56 PDT 2024


Author: RichardLuo
Date: 2024-06-25T09:57:53-05:00
New Revision: ed1273d4ddee160f847cbee28714c79353022a3c

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

LOG: [libc++] change the visibility of libc++ header to public in libcxx module (#91240)

This PR addresses a problem that headers may not be able to be found if
`#include` is used with std modules.

Consider the following file:

    #include <boost/json.hpp>
    import std;

    int main(int, const char **) { }


Boost will include something from libc++, but we are using -nostdinc++
at [1] so the compiler can not find any default std header. Therefore 
the locally built header needs to be public.

[1]: https://github.com/RichardLuo0/llvm-project/blob/15fdd47c4b110b64dc61f636e42e0484bf8bdbe0/libcxx/modules/CMakeLists.txt.in#L52

Added: 
    

Modified: 
    libcxx/modules/CMakeLists.txt.in

Removed: 
    


################################################################################
diff  --git a/libcxx/modules/CMakeLists.txt.in b/libcxx/modules/CMakeLists.txt.in
index c35f6fecb1fd7..9fef16e9cefde 100644
--- a/libcxx/modules/CMakeLists.txt.in
+++ b/libcxx/modules/CMakeLists.txt.in
@@ -41,7 +41,7 @@ target_sources(std
     std.cppm
 )
 
-target_include_directories(std SYSTEM PRIVATE @LIBCXX_CONFIGURED_INCLUDE_DIRS@)
+target_include_directories(std SYSTEM PUBLIC @LIBCXX_CONFIGURED_INCLUDE_DIRS@)
 
 if (NOT @LIBCXX_ENABLE_EXCEPTIONS@)
   target_compile_options(std PUBLIC -fno-exceptions)


        


More information about the libcxx-commits mailing list