Debian Codegraph @

clang/test/Driver/modules-print-library-module-manifest-path.cpp

raw
1 // Test that -print-library-module-manifest-path finds the correct file.
2
3 // RUN: rm -rf %t && split-file %s %t && cd %t
4 // RUN: mkdir -p %t/Inputs/usr/lib/x86_64-linux-gnu
5 // RUN: touch %t/Inputs/usr/lib/x86_64-linux-gnu/libc++.so
6 // RUN: touch %t/Inputs/usr/lib/x86_64-linux-gnu/libc++.a
7
8 // RUN: %clang -print-library-module-manifest-path \
9 // RUN: -stdlib=libc++ \
10 // RUN: -resource-dir=%t/Inputs/usr/lib/x86_64-linux-gnu \
11 // RUN: --target=x86_64-linux-gnu 2>&1 \
12 // RUN: | FileCheck libcxx-no-module-json.cpp
13
14 // RUN: touch %t/Inputs/usr/lib/x86_64-linux-gnu/libc++.modules.json
15 // RUN: %clang -print-library-module-manifest-path \
16 // RUN: -stdlib=libc++ \
17 // RUN: -resource-dir=%t/Inputs/usr/lib/x86_64-linux-gnu \
18 // RUN: --target=x86_64-linux-gnu 2>&1 \
19 // RUN: | FileCheck libcxx.cpp
20
21 // check that -nostdlib causes no library-provided module manifest to
22 // be reported, even when libc++.modules.json is present.
23 // RUN: %clang -print-library-module-manifest-path \
24 // RUN: -nostdlib \
25 // RUN: -resource-dir=%t/Inputs/usr/lib/x86_64-linux-gnu \
26 // RUN: --target=x86_64-linux-gnu 2>&1 \
27 // RUN: | FileCheck libcxx-no-module-json.cpp
28
29 // for macos there is a different directory structure
30 // where the library and libc++.modules.json file are in lib
31 // directly but headers are in clang/ver directory which
32 // is the resource directory
33 // RUN: mkdir -p %t/Inputs/usr/lib/clang/20
34 // RUN: touch %t/Inputs/usr/lib/libc++.so
35 // RUN: touch %t/Inputs/usr/lib/libc++.modules.json
36 // RUN: %clang -print-library-module-manifest-path \
37 // RUN: -stdlib=libc++ \
38 // RUN: -resource-dir=%t/Inputs/usr/lib/clang/20 \
39 // RUN: --target=arm64-apple-darwin24.1.0 2>&1 \
40 // RUN: | FileCheck libcxx.cpp.macos
41
42 // RUN: rm %t/Inputs/usr/lib/libc++.so
43 // RUN: touch %t/Inputs/usr/lib/libc++.a
44 // RUN: touch %t/Inputs/usr/lib/libc++.modules.json
45 // RUN: %clang -print-library-module-manifest-path \
46 // RUN: -stdlib=libc++ \
47 // RUN: -resource-dir=%t/Inputs/usr/lib/clang/20 \
48 // RUN: --target=arm64-apple-darwin24.1.0 2>&1 \
49 // RUN: | FileCheck libcxx.cpp.macos
50
51 // RUN: rm %t/Inputs/usr/lib/x86_64-linux-gnu/libc++.so
52 // RUN: touch %t/Inputs/usr/lib/x86_64-linux-gnu/libc++.a
53 // RUN: %clang -print-library-module-manifest-path \
54 // RUN: -stdlib=libc++ \
55 // RUN: -resource-dir=%t/Inputs/usr/lib/x86_64-linux-gnu \
56 // RUN: --target=x86_64-linux-gnu 2>&1 \
57 // RUN: | FileCheck libcxx-no-shared-lib.cpp
58
59 // Testing with libstdc++
60 // RUN: touch %t/Inputs/usr/lib/x86_64-linux-gnu/libstdc++.so
61 // RUN: touch %t/Inputs/usr/lib/x86_64-linux-gnu/libstdc++.modules.json
62 // RUN: %clang -print-library-module-manifest-path \
63 // RUN: -stdlib=libstdc++ \
64 // RUN: -resource-dir=%t/Inputs/usr/lib/x86_64-linux-gnu \
65 // RUN: --target=x86_64-linux-gnu 2>&1 \
66 // RUN: | FileCheck libstdcxx.cpp
67
68 //--- libcxx-no-module-json.cpp
69
70 // CHECK: <NOT PRESENT>
71
72 //--- libcxx.cpp
73
74 // CHECK: {{.*}}/Inputs/usr/lib/x86_64-linux-gnu{{/|\\}}libc++.modules.json
75
76 //--- libcxx.cpp.macos
77
78 // CHECK: {{.*}}libc++.modules.json
79
80 //--- libcxx-no-shared-lib.cpp
81
82 // Note this might find a different path depending whether search path
83 // contains a different libc++.so.
84 // CHECK: {{.*}}libc++.modules.json
85
86 //--- libstdcxx.cpp
87
88 // CHECK: {{.*}}libstdc++.modules.json