diff options
-rw-r--r-- | lib/Frontend/ASTUnit.cpp | 7 | ||||
-rw-r--r-- | test/Index/crash-recovery-code-complete.c | 3 | ||||
-rw-r--r-- | test/Index/crash-recovery-reparse.c | 3 |
3 files changed, 11 insertions, 2 deletions
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index 4cbb2a3f13..c203ffa935 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -803,6 +803,13 @@ static std::string GetPreamblePCHPath() { // FIXME: This is lame; sys::Path should provide this function (in particular, // it should know how to find the temporary files dir). // FIXME: This is really lame. I copied this code from the Driver! + // FIXME: This is a hack so that we can override the preamble file during + // crash-recovery testing, which is the only case where the preamble files + // are not necessarily cleaned up. + const char *TmpFile = ::getenv("CINDEXTEST_PREAMBLE_FILE"); + if (TmpFile) + return TmpFile; + std::string Error; const char *TmpDir = ::getenv("TMPDIR"); if (!TmpDir) diff --git a/test/Index/crash-recovery-code-complete.c b/test/Index/crash-recovery-code-complete.c index a80bdc2aee..9cad985364 100644 --- a/test/Index/crash-recovery-code-complete.c +++ b/test/Index/crash-recovery-code-complete.c @@ -1,8 +1,9 @@ -// RUN: env CINDEXTEST_EDITING=1 \ +// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_PREAMBLE_FILE=%t-preamble.pch \ // RUN: not c-index-test -code-completion-at=%s:20:1 \ // RUN: "-remap-file=%s;%S/Inputs/crash-recovery-code-complete-remap.c" \ // RUN: %s 2> %t.err // RUN: FileCheck < %t.err -check-prefix=CHECK-CODE-COMPLETE-CRASH %s +// RUN: rm %t-preamble.pch // CHECK-CODE-COMPLETE-CRASH: Unable to perform code completion! // // REQUIRES: crash-recovery diff --git a/test/Index/crash-recovery-reparse.c b/test/Index/crash-recovery-reparse.c index e394bd18df..243a914ec4 100644 --- a/test/Index/crash-recovery-reparse.c +++ b/test/Index/crash-recovery-reparse.c @@ -1,8 +1,9 @@ -// RUN: env CINDEXTEST_EDITING=1 \ +// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_PREAMBLE_FILE=%t-preamble.pch \ // RUN: not c-index-test -test-load-source-reparse 1 local \ // RUN: -remap-file="%s;%S/Inputs/crash-recovery-reparse-remap.c" \ // RUN: %s 2> %t.err // RUN: FileCheck < %t.err -check-prefix=CHECK-REPARSE-SOURCE-CRASH %s +// RUN: rm %t-preamble.pch // CHECK-REPARSE-SOURCE-CRASH: Unable to reparse translation unit // // REQUIRES: crash-recovery |