]> granicus.if.org Git - clang/commitdiff
Actually check if lseek works instead of using a filename based heuristic.
authorRafael Espindola <rafael.espindola@gmail.com>
Fri, 10 Apr 2015 18:16:30 +0000 (18:16 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Fri, 10 Apr 2015 18:16:30 +0000 (18:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234620 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/FrontendActions.cpp

index 622ca8241c259bc5862f89e5abe3a6f586366ed3..082bf92f0970a835f8c4b30c0491ce0a2aec4b9d 100644 (file)
@@ -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);
 }