1// Ensure that when rebuilding a module we don't save its old modtime when
2// building modules that depend on it.
3
4// RUN: rm -rf %t
5// RUN: mkdir -p %t
6// This could be replaced by diamond_*, except we want to modify the top header
7// RUN: echo '@import l; @import r;' > %t/b.h
8// RUN: echo '@import t; // fromt l' > %t/l.h
9// RUN: echo '@import t; // fromt r' > %t/r.h
10
11// RUN: echo '// top' > %t/t.h-1
12// RUN: cat %t/t.h-1 > %t/t.h
13
14// RUN: echo 'module b { header "b.h" } module l { header "l.h" }' > %t/module.map-1
15// RUN: echo 'module r { header "r.h" } module t { header "t.h" }' > %t/module.map-2
16// RUN: cat %t/module.map-1 %t/module.map-2 > %t/module.map
17
18// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \
19// RUN:     -I %t -fsyntax-only %s -Rmodule-build 2>&1 \
20// RUN: | FileCheck -check-prefix=REBUILD-ALL %s
21// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \
22// RUN:     -I %t -fsyntax-only %s -Rmodule-build -verify
23
24// Add an identifier to ensure everything depending on t is out of date
25// RUN: echo 'extern int a;' > %t/t.h-2
26// RUN: cat %t/t.h-1 %t/t.h-2 > %t/t.h
27
28// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \
29// RUN:     -I %t -fsyntax-only %s -Rmodule-build 2>&1 \
30// RUN: | FileCheck -check-prefix=REBUILD-ALL %s
31// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \
32// RUN:     -I %t -fsyntax-only %s -Rmodule-build -verify
33
34// REBUILD-ALL: building module 'b'
35// REBUILD-ALL: building module 'l'
36// REBUILD-ALL: building module 't'
37// REBUILD-ALL: building module 'r'
38
39// Use -verify when expecting no modules to be rebuilt.
40// expected-no-diagnostics
41
42@import b;
43