1// REQUIRES: shell
2//
3// Check driver works
4// RUN: %clang -fmodules -fsyntax-only -fmodules-validate-input-files-content %s -### 2>&1 | FileCheck --check-prefix=CHECK-CC1 %s
5// CHECK-CC1: -fvalidate-ast-input-files-content
6//
7// PCH+Modules: Test that a mtime mismatch without content change is fine
8// RUN: rm -rf %t
9// RUN: mkdir %t
10// RUN: echo '// m.h' > %t/m.h
11// RUN: echo '#include "m.h"' > %t/a.h
12// RUN: echo 'module m { header "m.h" }' > %t/module.modulemap
13// RUN: %clang_cc1 -emit-pch -fmodules-cache-path=%t/cache -fmodules -fimplicit-module-maps -o %t/a.pch -I %t -x objective-c-header %t/a.h -fvalidate-ast-input-files-content
14// RUN: touch -m -a -t 202901010000 %t/m.h
15// RUN: %clang_cc1 -fsyntax-only -fmodules-cache-path=%t/cache -fmodules -fimplicit-module-maps -I %t -include-pch %t/a.pch %s -verify -fvalidate-ast-input-files-content
16//
17// PCH+Modules: Test that a mtime mismatch with content change
18// RUN: rm -rf %t
19// RUN: mkdir %t
20// RUN: echo '// m.h' > %t/m.h
21// RUN: echo '#include "m.h"' > %t/a.h
22// RUN: echo 'module m { header "m.h" }' > %t/module.modulemap
23// RUN: %clang_cc1 -emit-pch -fmodules-cache-path=%t/cache -fmodules -fimplicit-module-maps -o %t/a.pch -I %t -x objective-c-header %t/a.h -fvalidate-ast-input-files-content
24// RUN: echo '// m.x' > %t/m.h
25// RUN: touch -m -a -t 202901010000 %t/m.h
26// RUN: not %clang_cc1 -fsyntax-only -fmodules-cache-path=%t/cache -fmodules -fimplicit-module-maps -I %t -include-pch %t/a.pch %s -fvalidate-ast-input-files-content 2> %t/stderr
27// RUN: FileCheck %s < %t/stderr
28//
29// CHECK: file '[[M_H:.*[/\\]m\.h]]' has been modified since the precompiled header '[[A_PCH:.*/a\.pch]]' was built: content changed
30// CHECK: '[[M_H]]' required by '[[M_PCM:.*[/\\]m.*\.pcm]]'
31// CHECK: '[[M_PCM]]' required by '[[A_PCH]]'
32// CHECK: please rebuild precompiled header '[[A_PCH]]'
33// expected-no-diagnostics
34