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// RUN: echo '// top' > %t/t.h
11// RUN: echo 'module b { header "b.h" } module l { header "l.h" }' > %t/module.map
12// RUN: echo 'module r { header "r.h" } module t { header "t.h" }' >> %t/module.map
13
14// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \
15// RUN:     -I %t -fsyntax-only %s -Rmodule-build 2>&1 \
16// RUN: | FileCheck -check-prefix=REBUILD-ALL %s
17// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \
18// RUN:     -I %t -fsyntax-only %s -Rmodule-build -verify
19
20// Add an identifier to ensure everything depending on t is out of date
21// RUN: echo 'extern int a;' >> %t/t.h
22// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \
23// RUN:     -I %t -fsyntax-only %s -Rmodule-build 2>&1 \
24// RUN: | FileCheck -check-prefix=REBUILD-ALL %s
25// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \
26// RUN:     -I %t -fsyntax-only %s -Rmodule-build -verify
27
28// REBUILD-ALL: building module 'b'
29// REBUILD-ALL: building module 'l'
30// REBUILD-ALL: building module 't'
31// REBUILD-ALL: building module 'r'
32
33// Use -verify when expecting no modules to be rebuilt.
34// expected-no-diagnostics
35
36@import b;
37