xref: /llvm-project/clang/test/Modules/cxx20-force-check-input.cppm (revision 182e1c773421e097d42415fc4d9aee1fb431819a)
1// RUN: rm -rf %t
2// RUN: split-file %s %t
3//
4// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple \
5// RUN:     -fforce-check-cxx20-modules-input-files \
6// RUN:     %t/a.cppm -emit-module-interface -o %t/a.pcm
7//
8// RUN: echo "inline int bar = 46;" >> %t/foo.h
9// RUN: not %clang_cc1 -std=c++20 -triple %itanium_abi_triple \
10// RUN:     -fforce-check-cxx20-modules-input-files %t/a.pcm \
11// RUN:     -emit-llvm -o -  2>&1 | FileCheck %t/a.cppm -check-prefix=CHECK-HEADER-FAILURE
12// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple \
13// RUN:     -fforce-check-cxx20-modules-input-files \
14// RUN:     %t/a.cppm -emit-module-interface -o %t/a.pcm
15
16// RUN: echo "export int var = 43;" >> %t/a.cppm
17//
18// RUN: not %clang_cc1 -std=c++20 -triple %itanium_abi_triple \
19// RUN:     -fforce-check-cxx20-modules-input-files %t/a.pcm \
20// RUN:     -emit-llvm -o -  2>&1 | FileCheck %t/a.cppm -check-prefix=CHECK-FAILURE
21
22//--- foo.h
23inline int foo = 43;
24
25//--- a.cppm
26// expected-no-diagnostics
27module;
28#include "foo.h"
29export module a;
30export using ::foo;
31
32// CHECK-HEADER-FAILURE: fatal error:{{.*}}foo.h' has been modified since the AST file {{.*}}was built
33// CHECK-FAILURE: fatal error:{{.*}}a.cppm' has been modified since the AST file {{.*}}was built
34