]> granicus.if.org Git - clang/commitdiff
Revert r234620 and others, "Actually check if lseek works instead of using a filename...
authorNAKAMURA Takumi <geek4civic@gmail.com>
Mon, 13 Apr 2015 08:43:31 +0000 (08:43 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Mon, 13 Apr 2015 08:43:31 +0000 (08:43 +0000)
  r234620, "Actually check if lseek works instead of using a filename based heuristic."
  r234621, "Testcase for the previous commit."
  r234718, "Suppress clang/test/PCH/emit-pth.c on win32, for now while investigating."

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234730 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/FrontendActions.cpp
test/PCH/emit-pth.c [deleted file]

index 1acaf6862e3a5c0990d6d13710e6682c5b62c9ef..aa6e1732baea7b359af06fedd1cd0591fbd84588 100644 (file)
@@ -599,15 +599,15 @@ void DumpTokensAction::ExecuteAction() {
 
 void GeneratePTHAction::ExecuteAction() {
   CompilerInstance &CI = getCompilerInstance();
-  llvm::raw_fd_ostream *OS =
-    CI.createDefaultOutputFile(true, getCurrentFile());
-  if (!OS)
-    return;
-
-  if (!OS->supportsSeeking()) {
+  if (CI.getFrontendOpts().OutputFile.empty() ||
+      CI.getFrontendOpts().OutputFile == "-") {
     // 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);
 }
diff --git a/test/PCH/emit-pth.c b/test/PCH/emit-pth.c
deleted file mode 100644 (file)
index 63144b2..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-pth -o %t1 %s
-// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-pth -o - %s > %t2
-// RUN: cmp %t1 %t2
-// RUN: not %clang_cc1 -triple i386-unknown-unknown -emit-pth -o - %s 2>&1 | \
-// RUN: FileCheck %s
-
-// CHECK: PTH requires a seekable file for output!
-
-// MSVCRT's _lseek(SEEK_CUR) doesn't return -1 for raw_ostream::SupportSeeking.
-// REQUIRES: shell