1 // Clear out the module cache entirely, so we start from nothing. 2 // RUN: rm -rf %t 3 4 // Parse the file, such that building the module will cause Clang to crash. 5 // 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 2> %t.err 6 // RUN: FileCheck < %t.err -check-prefix=CHECK-CRASH %s 7 // CHECK-CRASH: crash-recovery-modules.m:16:9:{16:2-16:14}: fatal error: could not build module 'Crash' 8 9 // Parse the file again, without crashing, to make sure that 10 // subsequent parses do the right thing. 11 // 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 12 13 // REQUIRES: crash-recovery 14 // REQUIRES: shell 15 16 @import Crash; 17 18 #ifdef LIBCLANG_CRASH 19 #pragma clang __debug crash 20 #endif 21 22 void test() { 23 const char* error = getCrashString(); 24 } 25 26 27 // RUN: rm -rf %t 28 // Check that libclang crash-recovery works; both with a module building crash... 29 // 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 2> %t.err 30 // RUN: FileCheck < %t.err -check-prefix=CHECK-LIBCLANG-CRASH %s 31 // ...and with module building successful. 32 // 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 2> %t.err 33 // RUN: FileCheck < %t.err -check-prefix=CHECK-LIBCLANG-CRASH %s 34 // CHECK-LIBCLANG-CRASH: libclang: crash detected during parsing 35 // CHECK-LIBCLANG-CRASH: Unable to load translation unit! 36