diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-04-13 11:14:39 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-04-13 11:14:39 +0000 |
| commit | 463d4dd6c6cf85180e44a2a6a27b7d8ea6e5cfa4 (patch) | |
| tree | f5c57ec241caeded718ca31ccdf28c28d1d7214f /clang | |
| parent | a9b84abba8919e1ae36ffefbdb1e1dafa258630e (diff) | |
| download | bcm5719-llvm-463d4dd6c6cf85180e44a2a6a27b7d8ea6e5cfa4.tar.gz bcm5719-llvm-463d4dd6c6cf85180e44a2a6a27b7d8ea6e5cfa4.zip | |
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.
llvm-svn: 234738
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Frontend/FrontendActions.cpp | 11 | ||||
| -rw-r--r-- | clang/test/PCH/emit-pth.c | 7 |
2 files changed, 12 insertions, 6 deletions
diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp index 5f91ed0a974..5ffe65f9f2a 100644 --- a/clang/lib/Frontend/FrontendActions.cpp +++ b/clang/lib/Frontend/FrontendActions.cpp @@ -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); } diff --git a/clang/test/PCH/emit-pth.c b/clang/test/PCH/emit-pth.c new file mode 100644 index 00000000000..7f863cf1d4f --- /dev/null +++ b/clang/test/PCH/emit-pth.c @@ -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! |

