summaryrefslogtreecommitdiffstats
path: root/clang/test/PCH/modified-module-dependency.m
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2014-01-17 00:19:09 +0000
committerBen Langmuir <blangmuir@apple.com>2014-01-17 00:19:09 +0000
commite82630d5d55dbb977a2b0ffc46eeecceb0d2d914 (patch)
treee5e5d681182816563bae41ada3d71230ba236f52 /clang/test/PCH/modified-module-dependency.m
parentd1b151ed7cfafbaf87ed8e3dbec0929a0d174460 (diff)
downloadbcm5719-llvm-e82630d5d55dbb977a2b0ffc46eeecceb0d2d914.tar.gz
bcm5719-llvm-e82630d5d55dbb977a2b0ffc46eeecceb0d2d914.zip
Improve the error message when a PCH dependency is modified
Show the top-level pch file as the culprit, rather than the immediate dependency when a pch file imports a pcm from a module. To clarify the relationship, the pch import stack is printed as notes. The old behaviour was misleading when a pch imported a pcm (from a module), since removing the pcm would not fix the problem, whereas rebuilding the pch would. llvm-svn: 199446
Diffstat (limited to 'clang/test/PCH/modified-module-dependency.m')
-rw-r--r--clang/test/PCH/modified-module-dependency.m20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/PCH/modified-module-dependency.m b/clang/test/PCH/modified-module-dependency.m
new file mode 100644
index 00000000000..656fa345655
--- /dev/null
+++ b/clang/test/PCH/modified-module-dependency.m
@@ -0,0 +1,20 @@
+// RUN: rm -rf %t-dir
+// RUN: mkdir -p %t-dir
+// RUN: echo '@import test;' > %t-dir/prefix.h
+// RUN: echo 'void foo(void);' > %t-dir/test.h
+// RUN: cp %S/modified-module-dependency.module.map %t-dir/module.map
+
+// Precompile prefix.pch.
+// RUN: %clang_cc1 -x objective-c -I %t-dir -fmodules -fmodules-cache-path=%t-dir/cache -emit-pch %t-dir/prefix.h -o %t-dir/prefix.pch
+
+// Modify the dependency.
+// RUN: echo ' ' >> %t-dir/test.h
+
+// Run and check the diagnostics.
+// RUN: not %clang_cc1 -x objective-c -include-pch %t-dir/prefix.pch -fmodules -fmodules-cache-path=%t-dir/cache -fsyntax-only %s 2> %t-dir/log
+// RUN: FileCheck %s < %t-dir/log
+
+// CHECK: file '{{.*}}/test.h' has been modified since the precompiled header '{{.*}}prefix.pch' was built
+// CHECK: '{{.*}}/test.h' required by '{{.*}}/test.pcm'
+// CHECK: '{{.*}}/test.pcm' required by '{{.*}}/prefix.pch'
+// CHECK: please rebuild precompiled header '{{.*}}/prefix.pch'
OpenPOWER on IntegriCloud