2012-01-30 03:57:03 +08:00
|
|
|
// Clear out the module cache entirely, so we start from nothing.
|
|
|
|
// RUN: rm -rf %t
|
|
|
|
|
|
|
|
// Parse the file, such that building the module will cause Clang to crash.
|
2015-10-30 04:43:31 +08:00
|
|
|
// RUN: not env CINDEXTEST_FAILONERROR=1 c-index-test -test-load-source all -fmodules -fmodules-cache-path=%t -Xclang -fdisable-module-hash -I %S/Inputs/Headers -DCRASH %s > /dev/null 2> %t.err
|
2012-01-30 03:57:03 +08:00
|
|
|
// RUN: FileCheck < %t.err -check-prefix=CHECK-CRASH %s
|
2017-04-15 13:53:49 +08:00
|
|
|
// CHECK-CRASH: crash-recovery-modules.m:17:9:{17:2-17:14}: fatal error: could not build module 'Crash'
|
2012-01-30 03:57:03 +08:00
|
|
|
|
|
|
|
// Parse the file again, without crashing, to make sure that
|
|
|
|
// subsequent parses do the right thing.
|
2015-10-30 04:43:31 +08:00
|
|
|
// RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -test-load-source all -fmodules -fmodules-cache-path=%t -Xclang -fdisable-module-hash -I %S/Inputs/Headers %s > /dev/null
|
2012-01-30 03:57:03 +08:00
|
|
|
|
|
|
|
// REQUIRES: crash-recovery
|
2012-01-30 04:04:46 +08:00
|
|
|
// REQUIRES: shell
|
2017-04-15 13:53:49 +08:00
|
|
|
// UNSUPPORTED: libstdcxx-safe-mode
|
2012-01-30 03:57:03 +08:00
|
|
|
|
2012-12-12 06:11:52 +08:00
|
|
|
@import Crash;
|
2012-01-30 03:57:03 +08:00
|
|
|
|
2013-06-20 07:15:35 +08:00
|
|
|
#ifdef LIBCLANG_CRASH
|
|
|
|
#pragma clang __debug crash
|
|
|
|
#endif
|
|
|
|
|
2012-01-30 03:57:03 +08:00
|
|
|
void test() {
|
|
|
|
const char* error = getCrashString();
|
|
|
|
}
|
2013-06-20 07:15:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
// RUN: rm -rf %t
|
|
|
|
// Check that libclang crash-recovery works; both with a module building crash...
|
2015-10-30 04:43:31 +08:00
|
|
|
// RUN: not env CINDEXTEST_FAILONERROR=1 c-index-test -test-load-source all -fmodules -fmodules-cache-path=%t -Xclang -fdisable-module-hash -I %S/Inputs/Headers -DCRASH -DLIBCLANG_CRASH %s > /dev/null 2> %t.err
|
2013-06-20 07:15:35 +08:00
|
|
|
// RUN: FileCheck < %t.err -check-prefix=CHECK-LIBCLANG-CRASH %s
|
|
|
|
// ...and with module building successful.
|
2015-10-30 04:43:31 +08:00
|
|
|
// RUN: not env CINDEXTEST_FAILONERROR=1 c-index-test -test-load-source all -fmodules -fmodules-cache-path=%t -Xclang -fdisable-module-hash -I %S/Inputs/Headers -DLIBCLANG_CRASH %s > /dev/null 2> %t.err
|
2013-06-20 07:15:35 +08:00
|
|
|
// RUN: FileCheck < %t.err -check-prefix=CHECK-LIBCLANG-CRASH %s
|
|
|
|
// CHECK-LIBCLANG-CRASH: libclang: crash detected during parsing
|
|
|
|
// CHECK-LIBCLANG-CRASH: Unable to load translation unit!
|