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 // for macos there is a different directory structure
22 // where the library and libc++.modules.json file are in lib
23 // directly but headers are in clang/ver directory which
24 // is the resource directory
25 // RUN: mkdir -p %t/Inputs/usr/lib/clang/20
26 // RUN: touch %t/Inputs/usr/lib/libc++.so
27 // RUN: touch %t/Inputs/usr/lib/libc++.modules.json
28 // RUN: %clang -print-library-module-manifest-path \
29 // RUN: -stdlib=libc++ \
30 // RUN: -resource-dir=%t/Inputs/usr/lib/clang/20 \
31 // RUN: --target=arm64-apple-darwin24.1.0 2>&1 \
32 // RUN: | FileCheck libcxx.cpp.macos
33
34 // RUN: rm %t/Inputs/usr/lib/libc++.so
35 // RUN: touch %t/Inputs/usr/lib/libc++.a
36 // RUN: touch %t/Inputs/usr/lib/libc++.modules.json
37 // RUN: %clang -print-library-module-manifest-path \
38 // RUN: -stdlib=libc++ \
39 // RUN: -resource-dir=%t/Inputs/usr/lib/clang/20 \
40 // RUN: --target=arm64-apple-darwin24.1.0 2>&1 \
41 // RUN: | FileCheck libcxx.cpp.macos
42
43 // RUN: rm %t/Inputs/usr/lib/x86_64-linux-gnu/libc++.so
44 // RUN: touch %t/Inputs/usr/lib/x86_64-linux-gnu/libc++.a
45 // RUN: %clang -print-library-module-manifest-path \
46 // RUN: -stdlib=libc++ \
47 // RUN: -resource-dir=%t/Inputs/usr/lib/x86_64-linux-gnu \
48 // RUN: --target=x86_64-linux-gnu 2>&1 \
49 // RUN: | FileCheck libcxx-no-shared-lib.cpp
50
51 // RUN: %clang -print-library-module-manifest-path \
52 // RUN: -stdlib=libstdc++ \
53 // RUN: -resource-dir=%t/Inputs/usr/lib/x86_64-linux-gnu \
54 // RUN: --target=x86_64-linux-gnu 2>&1 \
55 // RUN: | FileCheck libstdcxx.cpp
56
57 //--- libcxx-no-module-json.cpp
58
59 // CHECK: <NOT PRESENT>
60
61 //--- libcxx.cpp
62
63 // CHECK: {{.*}}/Inputs/usr/lib/x86_64-linux-gnu{{/|\\}}libc++.modules.json
64
65 //--- libcxx.cpp.macos
66
67 // CHECK: {{.*}}libc++.modules.json
68
69 //--- libcxx-no-shared-lib.cpp
70
71 // Note this might find a different path depending whether search path
72 // contains a different libc++.so.
73 // CHECK: {{.*}}libc++.modules.json
74
75 //--- libstdcxx.cpp
76
77 // CHECK: <NOT PRESENT>