r234620 - Actually check if lseek works instead of using a filename based heuristic.

Rafael Espindola rafael.espindola at gmail.com
Fri Apr 10 11:16:30 PDT 2015


Author: rafael
Date: Fri Apr 10 13:16:30 2015
New Revision: 234620

URL: http://llvm.org/viewvc/llvm-project?rev=234620&view=rev
Log:
Actually check if lseek works instead of using a filename based heuristic.

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

Modified: cfe/trunk/lib/Frontend/FrontendActions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendActions.cpp?rev=234620&r1=234619&r2=234620&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/FrontendActions.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendActions.cpp Fri Apr 10 13:16:30 2015
@@ -600,15 +600,15 @@ void DumpTokensAction::ExecuteAction() {
 
 void GeneratePTHAction::ExecuteAction() {
   CompilerInstance &CI = getCompilerInstance();
-  if (CI.getFrontendOpts().OutputFile.empty() ||
-      CI.getFrontendOpts().OutputFile == "-") {
+  llvm::raw_fd_ostream *OS =
+    CI.createDefaultOutputFile(true, getCurrentFile());
+  if (!OS)
+    return;
+
+  if (!OS->supportsSeeking()) {
     // FIXME: Don't fail this way.
-    // FIXME: Verify that we can actually seek in the given file.
     llvm::report_fatal_error("PTH requires a seekable file for output!");
   }
-  llvm::raw_fd_ostream *OS =
-    CI.createDefaultOutputFile(true, getCurrentFile());
-  if (!OS) return;
 
   CacheTokens(CI.getPreprocessor(), OS);
 }





More information about the cfe-commits mailing list