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