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