[SystemZ][z/OS] Set files in FileRemapper.cpp are text

This patch sets files in FileRemapper to open as text.

Reviewed By: Jonathan.Crowther

Differential Revision: https://reviews.llvm.org/D100056
This commit is contained in:
Abhina Sreeskantharajan 2021-04-19 07:59:23 -04:00
parent 228207fe94
commit fbc3259346
1 changed files with 6 additions and 5 deletions

View File

@ -63,7 +63,7 @@ bool FileRemapper::initFromFile(StringRef filePath, DiagnosticsEngine &Diag,
std::vector<std::pair<const FileEntry *, const FileEntry *> > pairs;
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> fileBuf =
llvm::MemoryBuffer::getFile(infoFile);
llvm::MemoryBuffer::getFile(infoFile, /*IsText=*/true);
if (!fileBuf)
return report("Error opening file: " + infoFile, Diag);
@ -121,7 +121,7 @@ bool FileRemapper::flushToFile(StringRef outputPath, DiagnosticsEngine &Diag) {
std::error_code EC;
std::string infoFile = std::string(outputPath);
llvm::raw_fd_ostream infoOut(infoFile, EC, llvm::sys::fs::OF_None);
llvm::raw_fd_ostream infoOut(infoFile, EC, llvm::sys::fs::OF_Text);
if (EC)
return report(EC.message(), Diag);
@ -142,9 +142,10 @@ bool FileRemapper::flushToFile(StringRef outputPath, DiagnosticsEngine &Diag) {
SmallString<64> tempPath;
int fd;
if (fs::createTemporaryFile(path::filename(origFE->getName()),
path::extension(origFE->getName()).drop_front(), fd,
tempPath))
if (fs::createTemporaryFile(
path::filename(origFE->getName()),
path::extension(origFE->getName()).drop_front(), fd, tempPath,
llvm::sys::fs::OF_Text))
return report("Could not create file: " + tempPath.str(), Diag);
llvm::raw_fd_ostream newOut(fd, /*shouldClose=*/true);