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