1 #include "foo.h" 2 3 // Clear the module cache. 4 // RUN: rm -rf %t 5 // RUN: mkdir -p %t/Inputs 6 // RUN: mkdir -p %t/modules-to-compare 7 8 // === 9 // Create a module with system headers. 10 // RUN: echo 'void meow(void);' > %t/Inputs/foo.h 11 // RUN: echo 'module Foo [system] { header "foo.h" }' > %t/Inputs/module.map 12 13 // === 14 // Compile the module. 15 // RUN: %clang_cc1 -cc1 -fmodules -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -I %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s 16 // RUN: ls -R %t/modules-cache | grep Foo.pcm.timestamp 17 // RUN: cp %t/modules-cache/Foo.pcm %t/modules-to-compare/Foo-before.pcm 18 19 // === 20 // Use it, and make sure that we did not recompile it. 21 // RUN: %clang_cc1 -cc1 -fmodules -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -I %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s 22 // RUN: ls -R %t/modules-cache | grep Foo.pcm.timestamp 23 // RUN: cp %t/modules-cache/Foo.pcm %t/modules-to-compare/Foo-after.pcm 24 25 // RUN: diff %t/modules-to-compare/Foo-before.pcm %t/modules-to-compare/Foo-after.pcm 26 27 // === 28 // Change the sources. 29 // RUN: echo 'void meow2(void);' > %t/Inputs/foo.h 30 31 // === 32 // Use the module, and make sure that we did not recompile it, even though the sources changed. 33 // RUN: %clang_cc1 -cc1 -fmodules -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -I %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s 34 // RUN: ls -R %t/modules-cache | grep Foo.pcm.timestamp 35 // RUN: cp %t/modules-cache/Foo.pcm %t/modules-to-compare/Foo-after.pcm 36 37 // RUN: diff %t/modules-to-compare/Foo-before.pcm %t/modules-to-compare/Foo-after.pcm 38 39 // === 40 // Recompile the module if the today's date is before 01 January 2030. 41 // RUN: %clang_cc1 -cc1 -fmodules -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -I %t/Inputs -fbuild-session-timestamp=1893456000 -fmodules-validate-once-per-build-session %s 42 // RUN: ls -R %t/modules-cache | grep Foo.pcm.timestamp 43 // RUN: cp %t/modules-cache/Foo.pcm %t/modules-to-compare/Foo-after.pcm 44 45 // RUN: not diff %t/modules-to-compare/Foo-before.pcm %t/modules-to-compare/Foo-after.pcm 46