1// REQUIRES: shell
2//
3// Check driver works
4// RUN: %clang -x objective-c-header -fsyntax-only -fpch-validate-input-files-content %s -### 2>&1 | FileCheck --check-prefix=CHECK-CC1 %s
5// CHECK-CC1: -fvalidate-ast-input-files-content
6//
7// PCH only: 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: %clang_cc1 -emit-pch -o %t/a.pch -I %t -x objective-c-header %t/a.h -fvalidate-ast-input-files-content
13// RUN: touch -m -a -t 202901010000 %t/m.h
14// RUN: %clang_cc1 -fsyntax-only -I %t -include-pch %t/a.pch %s -verify -fvalidate-ast-input-files-content
15//
16// PCH only: Test that a mtime mismatch with content change
17// RUN: rm -rf %t
18// RUN: mkdir %t
19// RUN: echo '// m.h' > %t/m.h
20// RUN: echo '#include "m.h"' > %t/a.h
21// RUN: %clang_cc1 -emit-pch -o %t/a.pch -I %t -x objective-c-header %t/a.h -fvalidate-ast-input-files-content
22// RUN: echo '// m.x' > %t/m.h
23// RUN: touch -m -a -t 202901010000 %t/m.h
24// RUN: not %clang_cc1 -fsyntax-only -I %t -include-pch %t/a.pch %s -fvalidate-ast-input-files-content 2> %t/stderr
25// RUN: FileCheck %s < %t/stderr
26//
27// CHECK: file '[[M_H:.*[/\\]m\.h]]' has been modified since the precompiled header '[[A_PCH:.*/a\.pch]]' was built: content changed
28// CHECK: please rebuild precompiled header '[[A_PCH]]'
29// expected-no-diagnostics
30