summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-05-24 05:44:08 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-05-24 05:44:08 +0000
commitdc9fdaf2171cc480300d5572606a8ede1678d18b (patch)
treedf9549534016f49322087b6780ade57739f298ae /clang/test
parentaa7906815724171e3f81d71fb9b12fd13b845311 (diff)
downloadbcm5719-llvm-dc9fdaf2171cc480300d5572606a8ede1678d18b.tar.gz
bcm5719-llvm-dc9fdaf2171cc480300d5572606a8ede1678d18b.zip
[modules] If we hit a failure while loading a PCH/module, abort parsing instead of trying to continue in an invalid state.
Also don't let libclang create a PCH with such an error. Fixes rdar://13953768 llvm-svn: 182629
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Modules/fatal-module-loader-error.m26
1 files changed, 26 insertions, 0 deletions
diff --git a/clang/test/Modules/fatal-module-loader-error.m b/clang/test/Modules/fatal-module-loader-error.m
new file mode 100644
index 00000000000..acfc5391128
--- /dev/null
+++ b/clang/test/Modules/fatal-module-loader-error.m
@@ -0,0 +1,26 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: touch %t/Module.pcm
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t %s -fdisable-module-hash -F %S/Inputs -verify
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t %s -fdisable-module-hash -F %S/Inputs -DIMPLICIT -verify
+
+// This tests that after a fatal module loader error, we do not continue parsing.
+
+#ifdef IMPLICIT
+
+// expected-error@+1{{does not appear to be}}
+#import <Module/Module.h>
+#pragma clang __debug crash;
+
+#else
+
+// expected-error@+1{{does not appear to be}}
+@import Module;
+#pragma clang __debug crash;
+
+#endif
+
+// Also check that libclang does not create a PCH with such an error.
+// RUN: c-index-test -write-pch %t.pch -fmodules -fmodules-cache-path=%t %s \
+// RUN: -Xclang -fdisable-module-hash -F %S/Inputs 2>&1 | Filecheck %s
+// CHECK: Unable to write PCH file
OpenPOWER on IntegriCloud