[clang] [clang][modules] Print library module manifest path. (PR #76451)

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 18 11:17:32 PST 2024


================
@@ -0,0 +1,40 @@
+// Test that -print-library-module-manifest-path finds the correct file.
+
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: touch %t/libc++.so
+// RUN: split-file %s %t
+// RUN: cd %t
+
+// RUN: %clang -print-library-module-manifest-path \
+// RUN:     -stdlib=libc++ \
+// RUN:     --sysroot=%t \
+// RUN:     --target=x86_64-linux-gnu 2>&1 \
+// RUN:   | FileCheck libcxx-no-module-json.cpp
+
+// RUN: touch %t/modules.json
+// RUN: %clang -print-library-module-manifest-path \
+// RUN:     -stdlib=libc++ \
+// RUN:     --sysroot=%t \
+// RUN:     --target=x86_64-linux-gnu 2>&1 \
+// RUN:   | FileCheck libcxx.cpp
----------------
MaskRay wrote:

`GetFilePath("libc++.so")` may return `libc++.so` (no directory), which does not exist.

I think a better test is

```
%clang --target=x86_64-unknown-linux-gnu -ccc-install-dir %S/Inputs/basic_linux_libcxx_tree/usr/bin -stdlib=libc++ ...
```
and create an empty file `Inputs/basic_linux_libcxx_tree/usr/lib/x86_64-unknown-linux-gnu/libc++.so`

https://github.com/llvm/llvm-project/pull/76451


More information about the cfe-commits mailing list