Skip to content

Commit 3b6cc94

Browse files
authored
[SystemZ][z/OS] Mark text files as text in ClangScanDeps (#127514)
This patch continues the work that was started here https://reviews.llvm.org/D99426 to correctly open text files in text mode.
1 parent 7e2707a commit 3b6cc94

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

clang/tools/clang-scan-deps/ClangScanDeps.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,12 +298,14 @@ class ResourceDirectoryCache {
298298
};
299299
if (llvm::sys::ExecuteAndWait(ClangBinaryPath, PrintResourceDirArgs, {},
300300
Redirects)) {
301-
auto ErrorBuf = llvm::MemoryBuffer::getFile(ErrorFile.c_str());
301+
auto ErrorBuf =
302+
llvm::MemoryBuffer::getFile(ErrorFile.c_str(), /*IsText=*/true);
302303
llvm::errs() << ErrorBuf.get()->getBuffer();
303304
return "";
304305
}
305306

306-
auto OutputBuf = llvm::MemoryBuffer::getFile(OutputFile.c_str());
307+
auto OutputBuf =
308+
llvm::MemoryBuffer::getFile(OutputFile.c_str(), /*IsText=*/true);
307309
if (!OutputBuf)
308310
return "";
309311
StringRef Output = OutputBuf.get()->getBuffer().rtrim('\n');
@@ -1032,7 +1034,8 @@ int clang_scan_deps_main(int argc, char **argv, const llvm::ToolContext &) {
10321034
std::unique_ptr<llvm::MemoryBuffer> TU;
10331035
std::optional<llvm::MemoryBufferRef> TUBuffer;
10341036
if (!TranslationUnitFile.empty()) {
1035-
auto MaybeTU = llvm::MemoryBuffer::getFile(TranslationUnitFile);
1037+
auto MaybeTU =
1038+
llvm::MemoryBuffer::getFile(TranslationUnitFile, /*IsText=*/true);
10361039
if (!MaybeTU) {
10371040
llvm::errs() << "cannot open input translation unit: "
10381041
<< MaybeTU.getError().message() << "\n";

0 commit comments

Comments
 (0)