[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Modules / no-implicit-builds.cpp
blobfa4d5cb3c53088c48623c2c8aa12960bd7165b8d
1 // RUN: rm -rf %t
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
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
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
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'}}
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
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
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
42 #include "Inputs/no-implicit-builds/b.h" // expected-error {{is needed but has not been provided}}