| 1 | // RUN: rm -rf %t |
| 2 | |
| 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 | |
| 7 | // Produce an error if a module is needed, but not found. |
| 8 | // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \ |
| 9 | // RUN: -fmodule-map-file=%S/Inputs/no-implicit-builds/b.modulemap \ |
| 10 | // RUN: -fno-implicit-modules %s -verify |
| 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 |
| 16 | |
| 17 | // Compile the module and put it into the cache. |
| 18 | // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \ |
| 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. |
| 26 | // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \ |
| 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: |
| 33 | // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodule-name=b -o %t/b.pcm \ |
| 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: |
| 38 | // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodule-file=%t/b.pcm \ |
| 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}} |
| 43 | |