llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: RichardLuo (RichardLuo0)

<details>
<summary>Changes</summary>

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:
```cpp
#include &lt;boost/json.hpp&gt;
import std;

int main(int, const char **) { }
```
boost will include something from libc++, but we are using 
[-nostdinc++](https://github.com/RichardLuo0/llvm-project/blob/15fdd47c4b110b64dc61f636e42e0484bf8bdbe0/libcxx/modules/CMakeLists.txt.in#L52),
 so the compiler can not find any default std header.
Therefore the locally built header needs to be public.

---
Full diff: https://github.com/llvm/llvm-project/pull/91182.diff


1 Files Affected:

- (modified) libcxx/modules/CMakeLists.txt.in (+2-2) 


``````````diff
diff --git a/libcxx/modules/CMakeLists.txt.in b/libcxx/modules/CMakeLists.txt.in
index e332d70cc16333..1f8f159e710cb9 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)
@@ -67,7 +67,7 @@ target_sources(std.compat
     std.compat.cppm
 )
 
-target_include_directories(std.compat SYSTEM PRIVATE 
@LIBCXX_CONFIGURED_INCLUDE_DIRS@)
+target_include_directories(std.compat SYSTEM PUBLIC 
@LIBCXX_CONFIGURED_INCLUDE_DIRS@)
 
 if (NOT @LIBCXX_ENABLE_EXCEPTIONS@)
   target_compile_options(std.compat PUBLIC -fno-exceptions)

``````````

</details>


https://github.com/llvm/llvm-project/pull/91182
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to