|
@@ -550,11 +550,11 @@ void CompilerInstance::clearOutputFiles(bool EraseFiles) {
|
|
|
|
|
|
}
|
|
|
OutputFiles.clear();
|
|
|
+ NonSeekStream.reset();
|
|
|
}
|
|
|
|
|
|
-llvm::raw_fd_ostream *
|
|
|
-CompilerInstance::createDefaultOutputFile(bool Binary,
|
|
|
- StringRef InFile,
|
|
|
+raw_pwrite_stream *
|
|
|
+CompilerInstance::createDefaultOutputFile(bool Binary, StringRef InFile,
|
|
|
StringRef Extension) {
|
|
|
return createOutputFile(getFrontendOpts().OutputFile, Binary,
|
|
|
/*RemoveFileOnSignal=*/true, InFile, Extension,
|
|
@@ -568,16 +568,14 @@ llvm::raw_null_ostream *CompilerInstance::createNullOutputFile() {
|
|
|
return Ret;
|
|
|
}
|
|
|
|
|
|
-llvm::raw_fd_ostream *
|
|
|
-CompilerInstance::createOutputFile(StringRef OutputPath,
|
|
|
- bool Binary, bool RemoveFileOnSignal,
|
|
|
- StringRef InFile,
|
|
|
- StringRef Extension,
|
|
|
- bool UseTemporary,
|
|
|
+raw_pwrite_stream *
|
|
|
+CompilerInstance::createOutputFile(StringRef OutputPath, bool Binary,
|
|
|
+ bool RemoveFileOnSignal, StringRef InFile,
|
|
|
+ StringRef Extension, bool UseTemporary,
|
|
|
bool CreateMissingDirectories) {
|
|
|
std::string OutputPathName, TempPathName;
|
|
|
std::error_code EC;
|
|
|
- std::unique_ptr<llvm::raw_fd_ostream> OS = createOutputFile(
|
|
|
+ std::unique_ptr<raw_pwrite_stream> OS = createOutputFile(
|
|
|
OutputPath, EC, Binary, RemoveFileOnSignal, InFile, Extension,
|
|
|
UseTemporary, CreateMissingDirectories, &OutputPathName, &TempPathName);
|
|
|
if (!OS) {
|
|
@@ -586,7 +584,7 @@ CompilerInstance::createOutputFile(StringRef OutputPath,
|
|
|
return nullptr;
|
|
|
}
|
|
|
|
|
|
- llvm::raw_fd_ostream *Ret = OS.get();
|
|
|
+ raw_pwrite_stream *Ret = OS.get();
|
|
|
// Add the output file -- but don't try to remove "-", since this means we are
|
|
|
// using stdin.
|
|
|
addOutputFile(OutputFile((OutputPathName != "-") ? OutputPathName : "",
|
|
@@ -595,7 +593,7 @@ CompilerInstance::createOutputFile(StringRef OutputPath,
|
|
|
return Ret;
|
|
|
}
|
|
|
|
|
|
-std::unique_ptr<llvm::raw_fd_ostream> CompilerInstance::createOutputFile(
|
|
|
+std::unique_ptr<llvm::raw_pwrite_stream> CompilerInstance::createOutputFile(
|
|
|
StringRef OutputPath, std::error_code &Error, bool Binary,
|
|
|
bool RemoveFileOnSignal, StringRef InFile, StringRef Extension,
|
|
|
bool UseTemporary, bool CreateMissingDirectories,
|
|
@@ -683,7 +681,13 @@ std::unique_ptr<llvm::raw_fd_ostream> CompilerInstance::createOutputFile(
|
|
|
if (TempPathName)
|
|
|
*TempPathName = TempFile;
|
|
|
|
|
|
- return OS;
|
|
|
+ if (!Binary || OS->supportsSeeking())
|
|
|
+ return std::move(OS);
|
|
|
+
|
|
|
+ auto B = llvm::make_unique<llvm::buffer_ostream>(*OS);
|
|
|
+ assert(!NonSeekStream);
|
|
|
+ NonSeekStream = std::move(OS);
|
|
|
+ return std::move(B);
|
|
|
}
|
|
|
|
|
|
// Initialization Utilities
|