summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/ASTUnit.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-09-11 17:56:52 +0000
committerDouglas Gregor <dgregor@apple.com>2010-09-11 17:56:52 +0000
commite10f0e5670e1440e37b826654afb5c61a113f2ac (patch)
treea601823b6f660ba0f6445eb0402da2f545f0beba /clang/lib/Frontend/ASTUnit.cpp
parentd4e42830cbb0ff712f7d68cfd523f57f7147c66a (diff)
downloadbcm5719-llvm-e10f0e5670e1440e37b826654afb5c61a113f2ac.tar.gz
bcm5719-llvm-e10f0e5670e1440e37b826654afb5c61a113f2ac.zip
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
Diffstat (limited to 'clang/lib/Frontend/ASTUnit.cpp')
-rw-r--r--clang/lib/Frontend/ASTUnit.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index 9fbaeeaac04..4cbb2a3f13a 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -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;
OpenPOWER on IntegriCloud