xref: /minix3/external/bsd/llvm/dist/clang/test/Modules/explicit-build-relpath.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1 // REQUIRES: shell
2 //
3 // RUN: rm -rf %t
4 // RUN: mkdir %t
5 // RUN: cd %t
6 
7 // ----------------------
8 // Build modules A and B.
9 // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
10 // RUN:            -fmodule-name=a -emit-module %S/Inputs/explicit-build/module.modulemap -o a.pcm
11 //
12 // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
13 // RUN:            -fmodule-file=a.pcm \
14 // RUN:            -fmodule-name=b -emit-module %S/Inputs/explicit-build/module.modulemap -o b-rel.pcm
15 //
16 // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
17 // RUN:            -fmodule-file=%t/a.pcm \
18 // RUN:            -fmodule-name=b -emit-module %S/Inputs/explicit-build/module.modulemap -o b-abs.pcm
19 
20 // ------------------------------------------
21 // Mix and match relative and absolute paths.
22 // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
23 // RUN:            -I%S/Inputs/explicit-build \
24 // RUN:            -fmodule-file=%t/a.pcm \
25 // RUN:            -fmodule-file=a.pcm \
26 // RUN:            -verify %s
27 //
28 // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
29 // RUN:            -I%S/Inputs/explicit-build \
30 // RUN:            -fmodule-file=%t/a.pcm \
31 // RUN:            -fmodule-file=b-rel.pcm \
32 // RUN:            -verify %s
33 //
34 // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
35 // RUN:            -I%S/Inputs/explicit-build \
36 // RUN:            -fmodule-file=a.pcm \
37 // RUN:            -fmodule-file=b-abs.pcm \
38 // RUN:            -verify %s
39 //
40 // RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
41 // RUN:            -I%S/Inputs/explicit-build \
42 // RUN:            -fmodule-file=b-rel.pcm \
43 // RUN:            -fmodule-file=b-abs.pcm \
44 // RUN:            -verify %s 2>&1 | FileCheck %s
45 // CHECK: module 'b' is defined in both '{{.*}}b-rel.pcm' and '{{.*}}b-abs.pcm'
46 
47 #include "a.h"
48 static_assert(a == 1, "");
49 // expected-no-diagnostics
50