From: Rafael Espindola Date: Fri, 10 Apr 2015 18:16:30 +0000 (+0000) Subject: Actually check if lseek works instead of using a filename based heuristic. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d9b45c07ea63d4bd7e9586798d092d843a9522ae;p=clang Actually check if lseek works instead of using a filename based heuristic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234620 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Frontend/FrontendActions.cpp b/lib/Frontend/FrontendActions.cpp index 622ca8241c..082bf92f09 100644 --- a/lib/Frontend/FrontendActions.cpp +++ b/lib/Frontend/FrontendActions.cpp @@ -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); }