If we fail to create a temporary file for the precompiled preamble,

just abort creation of the precompiled preamble rather than doing
silly things. This is the second part of the fix for the weird
preamble-related failures on Windows. Big thanks to Francois Pichet
for the great detective work!

llvm-svn: 113697
This commit is contained in:
Douglas Gregor 2010-09-11 17:56:52 +00:00
parent d4e42830cb
commit e10f0e5670
1 changed files with 10 additions and 1 deletions

View File

@ -1093,6 +1093,15 @@ llvm::MemoryBuffer *ASTUnit::getMainBufferWithPrecompiledPreamble(
return 0;
}
// Create a temporary file for the precompiled preamble. In rare
// circumstances, this can fail.
std::string PreamblePCHPath = GetPreamblePCHPath();
if (PreamblePCHPath.empty()) {
// Try again next time.
PreambleRebuildCounter = 1;
return 0;
}
// We did not previously compute a preamble, or it can't be reused anyway.
llvm::Timer *PreambleTimer = 0;
if (TimerGroup.get()) {
@ -1138,7 +1147,7 @@ llvm::MemoryBuffer *ASTUnit::getMainBufferWithPrecompiledPreamble(
if (::getenv("LIBCLANG_CHAINING"))
FrontendOpts.ChainedPCH = true;
// FIXME: Generate the precompiled header into memory?
FrontendOpts.OutputFile = GetPreamblePCHPath();
FrontendOpts.OutputFile = PreamblePCHPath;
// Create the compiler instance to use for building the precompiled preamble.
CompilerInstance Clang;