Manuel Klimek | d2e8b04 | 2015-02-20 11:44:41 +0000 | [diff] [blame] | 1 | // RUN: rm -rf %t |
| 2 | |
Richard Smith | 8d83d6d | 2016-03-21 19:06:06 +0000 | [diff] [blame] | 3 | // 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 Klimek | d2e8b04 | 2015-02-20 11:44:41 +0000 | [diff] [blame] | 7 | // Produce an error if a module is needed, but not found. |
Richard Smith | 47972af | 2015-06-16 00:08:24 +0000 | [diff] [blame] | 8 | // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \ |
Manuel Klimek | d2e8b04 | 2015-02-20 11:44:41 +0000 | [diff] [blame] | 9 | // RUN: -fmodule-map-file=%S/Inputs/no-implicit-builds/b.modulemap \ |
| 10 | // RUN: -fno-implicit-modules %s -verify |
Richard Smith | d520a25 | 2015-07-21 18:07:47 +0000 | [diff] [blame] | 11 | // |
| 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 Klimek | d2e8b04 | 2015-02-20 11:44:41 +0000 | [diff] [blame] | 16 | |
| 17 | // Compile the module and put it into the cache. |
Richard Smith | 47972af | 2015-06-16 00:08:24 +0000 | [diff] [blame] | 18 | // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \ |
Manuel Klimek | d2e8b04 | 2015-02-20 11:44:41 +0000 | [diff] [blame] | 19 | // 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 Smith | 47972af | 2015-06-16 00:08:24 +0000 | [diff] [blame] | 26 | // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \ |
Manuel Klimek | d2e8b04 | 2015-02-20 11:44:41 +0000 | [diff] [blame] | 27 | // 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 Smith | 47972af | 2015-06-16 00:08:24 +0000 | [diff] [blame] | 33 | // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodule-name=b -o %t/b.pcm \ |
Manuel Klimek | d2e8b04 | 2015-02-20 11:44:41 +0000 | [diff] [blame] | 34 | // 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 Smith | 47972af | 2015-06-16 00:08:24 +0000 | [diff] [blame] | 38 | // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodule-file=%t/b.pcm \ |
Manuel Klimek | d2e8b04 | 2015-02-20 11:44:41 +0000 | [diff] [blame] | 39 | // 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}} |