r234738 - Bring r234620 back now that llvm is fixed.
Rafael Espindola
rafael.espindola at gmail.com
Mon Apr 13 04:14:39 PDT 2015
Author: rafael
Date: Mon Apr 13 06:14:39 2015
New Revision: 234738
URL: http://llvm.org/viewvc/llvm-project?rev=234738&view=rev
Log:
Bring r234620 back now that llvm is fixed.
LLVM can now detect if a fd is seekable on windows.
Original commit message:
Actually check if lseek works instead of using a filename based heuristic.
Added:
cfe/trunk/test/PCH/emit-pth.c
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=234738&r1=234737&r2=234738&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/FrontendActions.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendActions.cpp Mon Apr 13 06:14:39 2015
@@ -599,16 +599,15 @@ void DumpTokensAction::ExecuteAction() {
void GeneratePTHAction::ExecuteAction() {
CompilerInstance &CI = getCompilerInstance();
- 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;
+ if (!OS->supportsSeeking()) {
+ // FIXME: Don't fail this way.
+ llvm::report_fatal_error("PTH requires a seekable file for output!");
+ }
+
CacheTokens(CI.getPreprocessor(), OS);
}
Added: cfe/trunk/test/PCH/emit-pth.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/emit-pth.c?rev=234738&view=auto
==============================================================================
--- cfe/trunk/test/PCH/emit-pth.c (added)
+++ cfe/trunk/test/PCH/emit-pth.c Mon Apr 13 06:14:39 2015
@@ -0,0 +1,7 @@
+// 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!
More information about the cfe-commits
mailing list