[clang] 3b6cc94 - [SystemZ][z/OS] Mark text files as text in ClangScanDeps (#127514)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 18 06:09:15 PST 2025
Author: Abhina Sree
Date: 2025-02-18T09:09:10-05:00
New Revision: 3b6cc94e7410b818658693885d4f5857c2fdbc6b
URL: https://github.com/llvm/llvm-project/commit/3b6cc94e7410b818658693885d4f5857c2fdbc6b
DIFF: https://github.com/llvm/llvm-project/commit/3b6cc94e7410b818658693885d4f5857c2fdbc6b.diff
LOG: [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.
Added:
Modified:
clang/tools/clang-scan-deps/ClangScanDeps.cpp
Removed:
################################################################################
diff --git a/clang/tools/clang-scan-deps/ClangScanDeps.cpp b/clang/tools/clang-scan-deps/ClangScanDeps.cpp
index 9cdb1eae56187..3bdeb461e4bfa 100644
--- a/clang/tools/clang-scan-deps/ClangScanDeps.cpp
+++ b/clang/tools/clang-scan-deps/ClangScanDeps.cpp
@@ -298,12 +298,14 @@ class ResourceDirectoryCache {
};
if (llvm::sys::ExecuteAndWait(ClangBinaryPath, PrintResourceDirArgs, {},
Redirects)) {
- auto ErrorBuf = llvm::MemoryBuffer::getFile(ErrorFile.c_str());
+ auto ErrorBuf =
+ llvm::MemoryBuffer::getFile(ErrorFile.c_str(), /*IsText=*/true);
llvm::errs() << ErrorBuf.get()->getBuffer();
return "";
}
- auto OutputBuf = llvm::MemoryBuffer::getFile(OutputFile.c_str());
+ auto OutputBuf =
+ llvm::MemoryBuffer::getFile(OutputFile.c_str(), /*IsText=*/true);
if (!OutputBuf)
return "";
StringRef Output = OutputBuf.get()->getBuffer().rtrim('\n');
@@ -1032,7 +1034,8 @@ int clang_scan_deps_main(int argc, char **argv, const llvm::ToolContext &) {
std::unique_ptr<llvm::MemoryBuffer> TU;
std::optional<llvm::MemoryBufferRef> TUBuffer;
if (!TranslationUnitFile.empty()) {
- auto MaybeTU = llvm::MemoryBuffer::getFile(TranslationUnitFile);
+ auto MaybeTU =
+ llvm::MemoryBuffer::getFile(TranslationUnitFile, /*IsText=*/true);
if (!MaybeTU) {
llvm::errs() << "cannot open input translation unit: "
<< MaybeTU.getError().message() << "\n";
More information about the cfe-commits
mailing list