Home | History | Annotate | Download | only in Modules
      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 -fimplicit-module-maps -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 // Same thing if we're running -cc1 and no module cache path has been provided.
      9 // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps \
     10 // RUN:     -fmodule-map-file=%S/Inputs/no-implicit-builds/b.modulemap \
     11 // RUN:     %s -verify
     12 
     13 // Compile the module and put it into the cache.
     14 // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \
     15 // RUN:     -fmodule-map-file=%S/Inputs/no-implicit-builds/b.modulemap \
     16 // RUN:     %s -Rmodule-build 2>&1 | FileCheck --check-prefix=CHECK-CACHE-BUILD %s
     17 // CHECK-CACHE-BUILD: {{building module 'b'}}
     18 
     19 // Produce an error if a module is found in the cache but implicit modules is off.
     20 // Note that the command line must match the command line for the first check, otherwise
     21 // this check might not find the module in the cache and trivially succeed.
     22 // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \
     23 // RUN:     -fmodule-map-file=%S/Inputs/no-implicit-builds/b.modulemap \
     24 // RUN:     %s -Rmodule-build -fno-implicit-modules -verify
     25 
     26 // Verify that we can still pass the module via -fmodule-file when implicit modules
     27 // are switched off:
     28 // - First, explicitly compile the module:
     29 // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodule-name=b -o %t/b.pcm \
     30 // RUN:     -emit-module %S/Inputs/no-implicit-builds/b.modulemap \
     31 // RUN:     -fno-implicit-modules
     32 //
     33 // - Next, verify that we can load it:
     34 // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodule-file=%t/b.pcm \
     35 // RUN:     -fmodule-map-file=%S/Inputs/no-implicit-builds/b.modulemap \
     36 // RUN:     -fno-implicit-modules %s
     37 
     38 #include "Inputs/no-implicit-builds/b.h"  // expected-error {{is needed but has not been provided}}
     39