Skip to content

Commit 2b3ddec

Browse files
authored
[SystemZ][z/OS] Open text files in text mode (#125570)
This patch continues the work that was started here https://reviews.llvm.org/D99426 to correctly open text files in text mode.
1 parent 3bd11b5 commit 2b3ddec

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

clang-tools-extra/clang-doc/HTMLGenerator.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ HTMLGenerator::generateDocs(StringRef RootDir,
964964
for (const auto &Group : FileToInfos) {
965965
std::error_code FileErr;
966966
llvm::raw_fd_ostream InfoOS(Group.getKey(), FileErr,
967-
llvm::sys::fs::OF_None);
967+
llvm::sys::fs::OF_Text);
968968
if (FileErr) {
969969
return llvm::createStringError(FileErr, "Error opening file '%s'",
970970
Group.getKey().str().c_str());
@@ -1047,7 +1047,7 @@ static llvm::Error serializeIndex(ClangDocContext &CDCtx) {
10471047
llvm::SmallString<128> FilePath;
10481048
llvm::sys::path::native(CDCtx.OutDirectory, FilePath);
10491049
llvm::sys::path::append(FilePath, "index_json.js");
1050-
llvm::raw_fd_ostream OS(FilePath, FileErr, llvm::sys::fs::OF_None);
1050+
llvm::raw_fd_ostream OS(FilePath, FileErr, llvm::sys::fs::OF_Text);
10511051
if (FileErr != OK) {
10521052
return llvm::createStringError(llvm::inconvertibleErrorCode(),
10531053
"error creating index file: " +
@@ -1108,7 +1108,7 @@ static llvm::Error genIndex(const ClangDocContext &CDCtx) {
11081108
llvm::SmallString<128> IndexPath;
11091109
llvm::sys::path::native(CDCtx.OutDirectory, IndexPath);
11101110
llvm::sys::path::append(IndexPath, "index.html");
1111-
llvm::raw_fd_ostream IndexOS(IndexPath, FileErr, llvm::sys::fs::OF_None);
1111+
llvm::raw_fd_ostream IndexOS(IndexPath, FileErr, llvm::sys::fs::OF_Text);
11121112
if (FileErr != OK) {
11131113
return llvm::createStringError(llvm::inconvertibleErrorCode(),
11141114
"error creating main index: " +

clang-tools-extra/clang-doc/MDGenerator.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ static llvm::Error serializeIndex(ClangDocContext &CDCtx) {
300300
llvm::SmallString<128> FilePath;
301301
llvm::sys::path::native(CDCtx.OutDirectory, FilePath);
302302
llvm::sys::path::append(FilePath, "all_files.md");
303-
llvm::raw_fd_ostream OS(FilePath, FileErr, llvm::sys::fs::OF_None);
303+
llvm::raw_fd_ostream OS(FilePath, FileErr, llvm::sys::fs::OF_Text);
304304
if (FileErr)
305305
return llvm::createStringError(llvm::inconvertibleErrorCode(),
306306
"error creating index file: " +
@@ -323,7 +323,7 @@ static llvm::Error genIndex(ClangDocContext &CDCtx) {
323323
llvm::SmallString<128> FilePath;
324324
llvm::sys::path::native(CDCtx.OutDirectory, FilePath);
325325
llvm::sys::path::append(FilePath, "index.md");
326-
llvm::raw_fd_ostream OS(FilePath, FileErr, llvm::sys::fs::OF_None);
326+
llvm::raw_fd_ostream OS(FilePath, FileErr, llvm::sys::fs::OF_Text);
327327
if (FileErr)
328328
return llvm::createStringError(llvm::inconvertibleErrorCode(),
329329
"error creating index file: " +
@@ -407,7 +407,7 @@ MDGenerator::generateDocs(StringRef RootDir,
407407
for (const auto &Group : FileToInfos) {
408408
std::error_code FileErr;
409409
llvm::raw_fd_ostream InfoOS(Group.getKey(), FileErr,
410-
llvm::sys::fs::OF_None);
410+
llvm::sys::fs::OF_Text);
411411
if (FileErr) {
412412
return llvm::createStringError(FileErr, "Error opening file '%s'",
413413
Group.getKey().str().c_str());

clang-tools-extra/clang-doc/YAMLGenerator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ YAMLGenerator::generateDocs(StringRef RootDir,
347347
}
348348

349349
std::error_code FileErr;
350-
llvm::raw_fd_ostream InfoOS(Path, FileErr, llvm::sys::fs::OF_None);
350+
llvm::raw_fd_ostream InfoOS(Path, FileErr, llvm::sys::fs::OF_Text);
351351
if (FileErr) {
352352
return llvm::createStringError(FileErr, "Error opening file '%s'",
353353
Path.c_str());

clang-tools-extra/clang-include-fixer/FuzzySymbolIndex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ FuzzySymbolIndex::queryRegexp(const std::vector<std::string> &Tokens) {
131131

132132
llvm::Expected<std::unique_ptr<FuzzySymbolIndex>>
133133
FuzzySymbolIndex::createFromYAML(StringRef FilePath) {
134-
auto Buffer = llvm::MemoryBuffer::getFile(FilePath);
134+
auto Buffer = llvm::MemoryBuffer::getFile(FilePath, /*IsText=*/true);
135135
if (!Buffer)
136136
return llvm::errorCodeToError(Buffer.getError());
137137
return std::make_unique<MemSymbolIndex>(

clang-tools-extra/clang-include-fixer/YamlSymbolIndex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace include_fixer {
2222

2323
llvm::ErrorOr<std::unique_ptr<YamlSymbolIndex>>
2424
YamlSymbolIndex::createFromFile(llvm::StringRef FilePath) {
25-
auto Buffer = llvm::MemoryBuffer::getFile(FilePath);
25+
auto Buffer = llvm::MemoryBuffer::getFile(FilePath, /*IsText=*/true);
2626
if (!Buffer)
2727
return Buffer.getError();
2828

clang-tools-extra/clang-include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ bool Merge(llvm::StringRef MergeDir, llvm::StringRef OutputFile) {
9595
// Parse YAML files in parallel.
9696
Pool.async(
9797
[&AddSymbols](std::string Path) {
98-
auto Buffer = llvm::MemoryBuffer::getFile(Path);
98+
auto Buffer = llvm::MemoryBuffer::getFile(Path, /*IsText=*/true);
9999
if (!Buffer) {
100100
llvm::errs() << "Can't open " << Path << "\n";
101101
return;
@@ -114,7 +114,7 @@ bool Merge(llvm::StringRef MergeDir, llvm::StringRef OutputFile) {
114114
}
115115
}
116116

117-
llvm::raw_fd_ostream OS(OutputFile, EC, llvm::sys::fs::OF_None);
117+
llvm::raw_fd_ostream OS(OutputFile, EC, llvm::sys::fs::OF_Text);
118118
if (EC) {
119119
llvm::errs() << "Can't open '" << OutputFile << "': " << EC.message()
120120
<< '\n';

clang-tools-extra/clang-include-fixer/tool/ClangIncludeFixer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ int includeFixerMain(int argc, const char **argv) {
415415
llvm::errs() << llvm::toString(InsertStyle.takeError()) << "\n";
416416
return 1;
417417
}
418-
auto Buffer = llvm::MemoryBuffer::getFile(FilePath);
418+
auto Buffer = llvm::MemoryBuffer::getFile(FilePath, /*IsText=*/true);
419419
if (!Buffer) {
420420
errs() << "Couldn't open file: " + FilePath.str() + ": "
421421
<< Buffer.getError().message() + "\n";

0 commit comments

Comments
 (0)