[cfe-commits] r113697 - /cfe/trunk/lib/Frontend/ASTUnit.cpp

Douglas Gregor dgregor at apple.com
Sat Sep 11 10:56:52 PDT 2010


Author: dgregor
Date: Sat Sep 11 12:56:52 2010
New Revision: 113697

URL: http://llvm.org/viewvc/llvm-project?rev=113697&view=rev
Log:
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!

Modified:
    cfe/trunk/lib/Frontend/ASTUnit.cpp

Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=113697&r1=113696&r2=113697&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTUnit.cpp Sat Sep 11 12:56:52 2010
@@ -1093,6 +1093,15 @@
     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 @@
   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;





More information about the cfe-commits mailing list