-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reland Print library module manifest path again (#84881)
Following of #82160 The reason why the above PR fails is that the `--sysroot` has lower priority than the libc++ built from the same source. On the one hand, it matches the codes behavior. We will add the built libc++ project paths in the ToolChain class. But we will only add the path related to sysroot in Linux class, which is derived from the ToolChain classes. So the paths of just built libc++ is in the front of the paths relative to sysroot. On the other hand, the behavior should be good from the higher level. Since the just built libc++ has the same version number with the just built clang, so it makes sense that these 2 compilers just matches. So for patch it self, I hacked it by using resource dir in the test since the resource dir has the higher priority, which is not strongly correct since we won't do that in practice. @kaz7 would you like to test on your environment to avoid this get reverted again? On the libc++ side, it shows that it lacks a `modules.json` file for the just built libc++ directory. If we don't have that, it will be problematic to use std modules from the just built clang and libc++ pair. Then it is not good. And I feel it may be problematic for future compiler/standard library developers. So I feel this is somewhat a libc++ issue that need to be fixed. Also if we don't like the hacked test in the current patch, we must wait for libc++ to fix this to proceed. But I feel this is somewhat odd since the test of clang shouldn't dependent on libc++. CC: @mordante --------- Co-authored-by: Mark de Wever <koraq@xs4all.nl>
- Loading branch information
1 parent
0269790
commit 0e1e1fc
Showing
4 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
clang/test/Driver/modules-print-library-module-manifest-path.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Test that -print-library-module-manifest-path finds the correct file. | ||
|
||
// RUN: rm -rf %t && split-file %s %t && cd %t | ||
// RUN: mkdir -p %t/Inputs/usr/lib/x86_64-linux-gnu | ||
// RUN: touch %t/Inputs/usr/lib/x86_64-linux-gnu/libc++.so | ||
|
||
// RUN: %clang -print-library-module-manifest-path \ | ||
// RUN: -stdlib=libc++ \ | ||
// RUN: -resource-dir=%t/Inputs/usr/lib/x86_64-linux-gnu \ | ||
// RUN: --target=x86_64-linux-gnu 2>&1 \ | ||
// RUN: | FileCheck libcxx-no-module-json.cpp | ||
|
||
// RUN: touch %t/Inputs/usr/lib/x86_64-linux-gnu/modules.json | ||
// RUN: %clang -print-library-module-manifest-path \ | ||
// RUN: -stdlib=libc++ \ | ||
// RUN: -resource-dir=%t/Inputs/usr/lib/x86_64-linux-gnu \ | ||
// RUN: --target=x86_64-linux-gnu 2>&1 \ | ||
// RUN: | FileCheck libcxx.cpp | ||
|
||
// RUN: %clang -print-library-module-manifest-path \ | ||
// RUN: -stdlib=libstdc++ \ | ||
// RUN: -resource-dir=%t/Inputs/usr/lib/x86_64-linux-gnu \ | ||
// RUN: --target=x86_64-linux-gnu 2>&1 \ | ||
// RUN: | FileCheck libstdcxx.cpp | ||
|
||
//--- libcxx-no-module-json.cpp | ||
|
||
// CHECK: <NOT PRESENT> | ||
|
||
//--- libcxx.cpp | ||
|
||
// CHECK: {{.*}}/Inputs/usr/lib/x86_64-linux-gnu{{/|\\}}modules.json | ||
|
||
//--- libstdcxx.cpp | ||
|
||
// CHECK: <NOT PRESENT> |