]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Modules/no-implicit-builds.cpp
Vendor import of clang trunk r238337:
[FreeBSD/FreeBSD.git] / test / Modules / no-implicit-builds.cpp
1 // RUN: rm -rf %t
2
3 // Produce an error if a module is needed, but not found.
4 // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t \
5 // RUN:     -fmodule-map-file=%S/Inputs/no-implicit-builds/b.modulemap \
6 // RUN:     -fno-implicit-modules %s -verify
7
8 // Compile the module and put it into the cache.
9 // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t \
10 // RUN:     -fmodule-map-file=%S/Inputs/no-implicit-builds/b.modulemap \
11 // RUN:     %s -Rmodule-build 2>&1 | FileCheck --check-prefix=CHECK-CACHE-BUILD %s
12 // CHECK-CACHE-BUILD: {{building module 'b'}}
13
14 // Produce an error if a module is found in the cache but implicit modules is off.
15 // Note that the command line must match the command line for the first check, otherwise
16 // this check might not find the module in the cache and trivially succeed.
17 // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodules-cache-path=%t \
18 // RUN:     -fmodule-map-file=%S/Inputs/no-implicit-builds/b.modulemap \
19 // RUN:     %s -Rmodule-build -fno-implicit-modules -verify
20
21 // Verify that we can still pass the module via -fmodule-file when implicit modules
22 // are switched off:
23 // - First, explicitly compile the module:
24 // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodule-name=b -o %t/b.pcm \
25 // RUN:     -emit-module %S/Inputs/no-implicit-builds/b.modulemap \
26 // RUN:     -fno-implicit-modules
27 //
28 // - Next, verify that we can load it:
29 // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodule-file=%t/b.pcm \
30 // RUN:     -fmodule-map-file=%S/Inputs/no-implicit-builds/b.modulemap \
31 // RUN:     -fno-implicit-modules %s
32
33 #include "Inputs/no-implicit-builds/b.h"  // expected-error {{is needed but has not been provided}}