Ensure that we clean up after a failed module build and cope with the

results in libclang.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149200 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Douglas Gregor 2012-01-29 19:57:03 +00:00
Родитель c5b2e58840
Коммит 85ae12db3b
5 изменённых файлов: 32 добавлений и 1 удалений

Просмотреть файл

@ -576,6 +576,9 @@ public:
DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const { DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const {
// Just drop any diagnostics that come from cloned consumers; they'll // Just drop any diagnostics that come from cloned consumers; they'll
// have different source managers anyway. // 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(); return new IgnoringDiagConsumer();
} }
}; };

Просмотреть файл

@ -926,7 +926,7 @@ void LockFileManager::waitForUnlock() {
const unsigned MaxSeconds = 3600; const unsigned MaxSeconds = 3600;
do { do {
// Sleep for the designated interval, to allow the owning process time to // 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 // FIXME: Should we hook in to system APIs to get a notification when the
// lock file is deleted? // lock file is deleted?
#if LLVM_ON_WIN32 #if LLVM_ON_WIN32

Просмотреть файл

@ -0,0 +1,6 @@
// Produce a crash if CRASH is defined.
#ifdef CRASH
# pragma clang __debug crash
#endif
const char *getCrashString();

Просмотреть файл

@ -5,3 +5,6 @@ module LibA {
} }
} }
module Crash {
header "crash.h"
}

Просмотреть файл

@ -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();
}