This patch corrects more instances of text files being opened as text.
Reviewed By: Jonathan.Crowther
Differential Revision: https://reviews.llvm.org/D100654
// Parse the invocation descriptor.
StringRef Input = Argv[0];
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> Buffer =
- llvm::MemoryBuffer::getFile(Input);
+ llvm::MemoryBuffer::getFile(Input, /*IsText=*/true);
if (!Buffer) {
llvm::errs() << "error: failed to read " << Input << ": "
<< Buffer.getError().message() << "\n";
TempPath = Path;
llvm::sys::path::append(TempPath, "libclang-%%%%%%%%%%%%");
int FD;
- if (llvm::sys::fs::createUniqueFile(TempPath, FD, TempPath))
+ if (llvm::sys::fs::createUniqueFile(TempPath, FD, TempPath,
+ llvm::sys::fs::OF_Text))
return;
File = std::string(TempPath.begin(), TempPath.end());
llvm::raw_fd_ostream OS(FD, /*ShouldClose=*/true);
if (Filename.empty()) {
Filename = createGraphFilename(Name.str(), FD);
} else {
- std::error_code EC = sys::fs::openFileForWrite(Filename, FD);
+ std::error_code EC = sys::fs::openFileForWrite(
+ Filename, FD, sys::fs::CD_CreateAlways, sys::fs::OF_Text);
// Writing over an existing file is not considered an error.
if (EC == std::errc::file_exists) {