diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index c23c64497a..abeb3174bd 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -576,6 +576,9 @@ public: DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const { // Just drop any diagnostics that come from cloned consumers; they'll // have different source managers anyway. + // FIXME: We'd like to be able to capture these somehow, even if it's just + // file/line/column, because they could occur when parsing module maps or + // building modules on-demand. return new IgnoringDiagConsumer(); } }; diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp index cc8d3b48a2..4f6ba166a7 100644 --- a/lib/Frontend/CompilerInstance.cpp +++ b/lib/Frontend/CompilerInstance.cpp @@ -926,7 +926,7 @@ void LockFileManager::waitForUnlock() { const unsigned MaxSeconds = 3600; do { // Sleep for the designated interval, to allow the owning process time to - // finish up and + // finish up and remove the lock file. // FIXME: Should we hook in to system APIs to get a notification when the // lock file is deleted? #if LLVM_ON_WIN32 diff --git a/test/Index/Inputs/Headers/crash.h b/test/Index/Inputs/Headers/crash.h new file mode 100644 index 0000000000..238359abbe --- /dev/null +++ b/test/Index/Inputs/Headers/crash.h @@ -0,0 +1,6 @@ +// Produce a crash if CRASH is defined. +#ifdef CRASH +# pragma clang __debug crash +#endif + +const char *getCrashString(); diff --git a/test/Index/Inputs/Headers/module.map b/test/Index/Inputs/Headers/module.map index e875210662..55f8eb7eaa 100644 --- a/test/Index/Inputs/Headers/module.map +++ b/test/Index/Inputs/Headers/module.map @@ -5,3 +5,6 @@ module LibA { } } +module Crash { + header "crash.h" +} diff --git a/test/Index/crash-recovery-modules.m b/test/Index/crash-recovery-modules.m new file mode 100644 index 0000000000..195b50f42d --- /dev/null +++ b/test/Index/crash-recovery-modules.m @@ -0,0 +1,19 @@ +// 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. +// RUN: not env CINDEXTEST_FAILONERROR=1 c-index-test -test-load-source all -fmodules -fmodule-cache-path %t -Xclang -fdisable-module-hash -I %S/Inputs/Headers -DCRASH %s 2> %t.err +// RUN: FileCheck < %t.err -check-prefix=CHECK-CRASH %s +// CHECK-CRASH: crash-recovery-modules.m:15:9:{15:2-15:14}: fatal error: could not build module 'Crash' + +// Parse the file again, without crashing, to make sure that +// subsequent parses do the right thing. +// RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -test-load-source all -fmodules -fmodule-cache-path %t -Xclang -fdisable-module-hash -I %S/Inputs/Headers %s + +// REQUIRES: crash-recovery + +@import Crash; + +void test() { + const char* error = getCrashString(); +}