blob: fa4d5cb3c53088c48623c2c8aa12960bd7165b8d [file] [log] [blame]
Manuel Klimekd2e8b042015-02-20 11:44:41 +00001// RUN: rm -rf %t
2
Richard Smith8d83d6d2016-03-21 19:06:06 +00003// RUN: %clang -x c++ -std=c++11 -fmodules -fno-implicit-modules /dev/null -### \
4// RUN: 2>&1 | FileCheck --check-prefix=CHECK-NO-MODULE-CACHE %s
5// CHECK-NO-MODULE-CACHE-NOT: -fmodules-cache-path
6
Manuel Klimekd2e8b042015-02-20 11:44:41 +00007// Produce an error if a module is needed, but not found.
Richard Smith47972af2015-06-16 00:08:24 +00008// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \
Manuel Klimekd2e8b042015-02-20 11:44:41 +00009// RUN: -fmodule-map-file=%S/Inputs/no-implicit-builds/b.modulemap \
10// RUN: -fno-implicit-modules %s -verify
Richard Smithd520a252015-07-21 18:07:47 +000011//
12// Same thing if we're running -cc1 and no module cache path has been provided.
13// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps \
14// RUN: -fmodule-map-file=%S/Inputs/no-implicit-builds/b.modulemap \
15// RUN: %s -verify
Manuel Klimekd2e8b042015-02-20 11:44:41 +000016
17// Compile the module and put it into the cache.
Richard Smith47972af2015-06-16 00:08:24 +000018// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \
Manuel Klimekd2e8b042015-02-20 11:44:41 +000019// RUN: -fmodule-map-file=%S/Inputs/no-implicit-builds/b.modulemap \
20// RUN: %s -Rmodule-build 2>&1 | FileCheck --check-prefix=CHECK-CACHE-BUILD %s
21// CHECK-CACHE-BUILD: {{building module 'b'}}
22
23// Produce an error if a module is found in the cache but implicit modules is off.
24// Note that the command line must match the command line for the first check, otherwise
25// this check might not find the module in the cache and trivially succeed.
Richard Smith47972af2015-06-16 00:08:24 +000026// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \
Manuel Klimekd2e8b042015-02-20 11:44:41 +000027// RUN: -fmodule-map-file=%S/Inputs/no-implicit-builds/b.modulemap \
28// RUN: %s -Rmodule-build -fno-implicit-modules -verify
29
30// Verify that we can still pass the module via -fmodule-file when implicit modules
31// are switched off:
32// - First, explicitly compile the module:
Richard Smith47972af2015-06-16 00:08:24 +000033// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodule-name=b -o %t/b.pcm \
Manuel Klimekd2e8b042015-02-20 11:44:41 +000034// RUN: -emit-module %S/Inputs/no-implicit-builds/b.modulemap \
35// RUN: -fno-implicit-modules
36//
37// - Next, verify that we can load it:
Richard Smith47972af2015-06-16 00:08:24 +000038// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodule-file=%t/b.pcm \
Manuel Klimekd2e8b042015-02-20 11:44:41 +000039// RUN: -fmodule-map-file=%S/Inputs/no-implicit-builds/b.modulemap \
40// RUN: -fno-implicit-modules %s
41
42#include "Inputs/no-implicit-builds/b.h" // expected-error {{is needed but has not been provided}}