Clang Project

clang_source_code/test/Modules/implicit-invalidate-chain.c
1// RUN: rm -rf %t1 %t2 %t-include
2// RUN: mkdir %t-include
3// RUN: echo 'module D { header "D.h" }' >> %t-include/module.modulemap
4
5// Run with -verify, which onliy gets remarks from the main TU.
6//
7// RUN: echo '#define D 0' > %t-include/D.h
8// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t1 \
9// RUN:     -fdisable-module-hash -fsyntax-only \
10// RUN:     -I%S/Inputs/implicit-invalidate-chain -I%t-include \
11// RUN:     -Rmodule-build -Rmodule-import %s
12// RUN: echo '#define D 11' > %t-include/D.h
13// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t1 \
14// RUN:     -fdisable-module-hash -fsyntax-only \
15// RUN:     -I%S/Inputs/implicit-invalidate-chain -I%t-include \
16// RUN:     -Rmodule-build -Rmodule-import -verify %s
17
18// Run again, using FileCheck to check remarks from the module builds.  This is
19// the key test: after the first attempt to import an out-of-date 'D', all the
20// modules have been invalidated and are not imported again until they are
21// rebuilt.
22//
23// RUN: echo '#define D 0' > %t-include/D.h
24// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t2 \
25// RUN:     -fdisable-module-hash -fsyntax-only \
26// RUN:     -I%S/Inputs/implicit-invalidate-chain -I%t-include \
27// RUN:     -Rmodule-build -Rmodule-import %s
28// RUN: echo '#define D 11' > %t-include/D.h
29// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t2 \
30// RUN:     -fdisable-module-hash -fsyntax-only \
31// RUN:     -I%S/Inputs/implicit-invalidate-chain -I%t-include \
32// RUN:     -Rmodule-build -Rmodule-import %s 2>&1 |\
33// RUN: FileCheck %s -implicit-check-not "remark:"
34
35#include "A.h" // \
36   expected-remark-re{{importing module 'A' from '{{.*[/\\]}}A.pcm'}} \
37   expected-remark-re{{importing module 'B' into 'A' from '{{.*[/\\]}}B.pcm'}} \
38   expected-remark-re{{importing module 'C' into 'B' from '{{.*[/\\]}}C.pcm'}} \
39   expected-remark-re{{importing module 'D' into 'C' from '{{.*[/\\]}}D.pcm'}} \
40   expected-remark-re{{building module 'A' as '{{.*[/\\]}}A.pcm'}} \
41   expected-remark{{finished building module 'A'}} \
42   expected-remark-re{{importing module 'A' from '{{.*[/\\]}}A.pcm'}} \
43   expected-remark-re{{importing module 'B' into 'A' from '{{.*[/\\]}}B.pcm'}} \
44   expected-remark-re{{importing module 'C' into 'B' from '{{.*[/\\]}}C.pcm'}} \
45   expected-remark-re{{importing module 'D' into 'C' from '{{.*[/\\]}}D.pcm'}}
46// CHECK: remark: importing module 'A' from '{{.*[/\\]}}A.pcm'
47// CHECK: remark: importing module 'B' into 'A' from '{{.*[/\\]}}B.pcm'
48// CHECK: remark: importing module 'C' into 'B' from '{{.*[/\\]}}C.pcm'
49// CHECK: remark: importing module 'D' into 'C' from '{{.*[/\\]}}D.pcm'
50// CHECK: remark: building module 'A'
51// CHECK: remark: building module 'B'
52// CHECK: remark: building module 'C'
53// CHECK: remark: building module 'D'
54// CHECK: remark: finished building module 'D'
55// CHECK: remark: importing module 'D' from '{{.*[/\\]}}D.pcm'
56// CHECK: remark: finished building module 'C'
57// CHECK: remark: importing module 'C' from '{{.*[/\\]}}C.pcm'
58// CHECK: remark: importing module 'D' into 'C' from '{{.*[/\\]}}D.pcm'
59// CHECK: remark: finished building module 'B'
60// CHECK: remark: importing module 'B' from '{{.*[/\\]}}B.pcm'
61// CHECK: remark: importing module 'C' into 'B' from '{{.*[/\\]}}C.pcm'
62// CHECK: remark: importing module 'D' into 'C' from '{{.*[/\\]}}D.pcm'
63// CHECK: remark: finished building module 'A'
64// CHECK: remark: importing module 'A' from '{{.*[/\\]}}A.pcm'
65// CHECK: remark: importing module 'B' into 'A' from '{{.*[/\\]}}B.pcm'
66// CHECK: remark: importing module 'C' into 'B' from '{{.*[/\\]}}C.pcm'
67// CHECK: remark: importing module 'D' into 'C' from '{{.*[/\\]}}D.pcm'
68