[clang] [clang-tools-extra] [lld] [lldb] [llvm] [mlir] [SystemZ][z/OS] Mark text files as text (PR #228437)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 2 06:21:20 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-core
@llvm/pr-subscribers-clang-format
@llvm/pr-subscribers-clang-tidy
Author: Abhina Sree (abhina-sree)
<details>
<summary>Changes</summary>
This patch marks some more text files as text.
---
Patch is 85.53 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/228437.diff
86 Files Affected:
- (modified) clang-tools-extra/clang-include-fixer/FuzzySymbolIndex.cpp (+3-1)
- (modified) clang-tools-extra/clang-include-fixer/YamlSymbolIndex.cpp (+1-1)
- (modified) clang-tools-extra/clang-include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp (+2-1)
- (modified) clang-tools-extra/clang-include-fixer/tool/ClangIncludeFixer.cpp (+3-1)
- (modified) clang-tools-extra/clang-tidy/misc/ConfusableTable/BuildConfusableTable.cpp (+2-1)
- (modified) clang/lib/Driver/OffloadBundler.cpp (+6-5)
- (modified) clang/lib/ScalableStaticAnalysis/Core/Serialization/JSONFormat/JSONFormatImpl.cpp (+2-1)
- (modified) clang/lib/Tooling/JSONCompilationDatabase.cpp (+2-1)
- (modified) clang/tools/clang-format/ClangFormat.cpp (+2-2)
- (modified) clang/tools/clang-scan-deps/ClangScanDeps.cpp (+6-6)
- (modified) clang/tools/driver/cc1as_main.cpp (+2-1)
- (modified) clang/unittests/ScalableStaticAnalysis/Serialization/JSONFormatTest/JSONFormatTest.cpp (+4-2)
- (modified) clang/unittests/Serialization/PreambleInNamedModulesTest.cpp (+1-1)
- (modified) lld/COFF/Driver.cpp (+6-6)
- (modified) lld/COFF/DriverUtils.cpp (+1-1)
- (modified) lld/COFF/SymbolTable.cpp (+1-1)
- (modified) lld/ELF/InputFiles.cpp (+1-1)
- (modified) lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp (+1-1)
- (modified) lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp (+6-3)
- (modified) lldb/unittests/TestingSupport/TestUtilities.cpp (+3-3)
- (modified) llvm/benchmarks/RuntimeLibcalls.cpp (+3-1)
- (modified) llvm/include/llvm/Support/MemoryBuffer.h (+5-4)
- (modified) llvm/lib/Analysis/IR2Vec.cpp (+2-1)
- (modified) llvm/lib/AsmParser/Parser.cpp (+3-2)
- (modified) llvm/lib/BinaryFormat/Magic.cpp (+1-1)
- (modified) llvm/lib/CAS/OnDiskGraphDB.cpp (+2-2)
- (modified) llvm/lib/CodeGen/MIR2Vec.cpp (+3-1)
- (modified) llvm/lib/CodeGen/MIRParser/MIRParser.cpp (+3-1)
- (modified) llvm/lib/DTLTO/DTLTO.cpp (+1-1)
- (modified) llvm/lib/DebugInfo/GSYM/CallSiteInfo.cpp (+3-1)
- (modified) llvm/lib/DebugInfo/PDB/Native/InputFile.cpp (+1-1)
- (modified) llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp (+1-1)
- (modified) llvm/lib/Debuginfod/Debuginfod.cpp (+2-1)
- (modified) llvm/lib/FuzzMutate/FuzzerCLI.cpp (+1-1)
- (modified) llvm/lib/IRReader/IRReader.cpp (+2-1)
- (modified) llvm/lib/LTO/LTOCodeGenerator.cpp (+1-1)
- (modified) llvm/lib/Object/Archive.cpp (+2-1)
- (modified) llvm/lib/Object/Binary.cpp (+1-1)
- (modified) llvm/lib/ProfileData/Coverage/CoverageMapping.cpp (+2-2)
- (modified) llvm/lib/ProfileData/GCOV.cpp (+1-1)
- (modified) llvm/lib/ProfileData/MemProfReader.cpp (+3-2)
- (modified) llvm/lib/Support/MemoryBuffer.cpp (+14-14)
- (modified) llvm/lib/Support/SourceMgr.cpp (+2-2)
- (modified) llvm/lib/TableGen/Main.cpp (+3-2)
- (modified) llvm/lib/Target/DirectX/DXContainerPDB.cpp (+1-1)
- (modified) llvm/lib/Testing/Support/SupportHelpers.cpp (+1-1)
- (modified) llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp (+1-1)
- (modified) llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp (+4-3)
- (modified) llvm/lib/Transforms/IPO/LowerTypeTests.cpp (+1-1)
- (modified) llvm/tools/dsymutil/DebugMap.cpp (+3-1)
- (modified) llvm/tools/dsymutil/dsymutil.cpp (+1-1)
- (modified) llvm/tools/lli/lli.cpp (+1-1)
- (modified) llvm/tools/llvm-ar/llvm-ar.cpp (+2-2)
- (modified) llvm/tools/llvm-cas-fuzzer/cas-fuzzer.cpp (+1-1)
- (modified) llvm/tools/llvm-cov/gcov.cpp (+2-2)
- (modified) llvm/tools/llvm-ctxprof-util/llvm-ctxprof-util.cpp (+2-1)
- (modified) llvm/tools/llvm-cvtres/llvm-cvtres.cpp (+2-2)
- (modified) llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp (+3-3)
- (modified) llvm/tools/llvm-debuginfod-find/llvm-debuginfod-find.cpp (+1-1)
- (modified) llvm/tools/llvm-exegesis/llvm-exegesis.cpp (+2-2)
- (modified) llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp (+2-2)
- (modified) llvm/tools/llvm-ifs/llvm-ifs.cpp (+2-1)
- (modified) llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp (+1-1)
- (modified) llvm/tools/llvm-link/llvm-link.cpp (+3-2)
- (modified) llvm/tools/llvm-mc/llvm-mc.cpp (+2-1)
- (modified) llvm/tools/llvm-objdump/SourcePrinter.cpp (+2-1)
- (modified) llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp (+1-1)
- (modified) llvm/tools/llvm-rc/ResourceFileWriter.cpp (+1-1)
- (modified) llvm/tools/llvm-rc/llvm-rc.cpp (+2-2)
- (modified) llvm/tools/llvm-readobj/llvm-readobj.cpp (+1-1)
- (modified) llvm/tools/llvm-readtapi/llvm-readtapi.cpp (+1-1)
- (modified) llvm/tools/llvm-reduce/ReducerWorkItem.cpp (+3-1)
- (modified) llvm/tools/llvm-strings/llvm-strings.cpp (+2-1)
- (modified) llvm/tools/obj2yaml/obj2yaml.cpp (+1-1)
- (modified) llvm/tools/sanstats/sanstats.cpp (+1-1)
- (modified) llvm/tools/yaml2obj/yaml2obj.cpp (+1-1)
- (modified) llvm/unittests/DebugInfo/PDB/TpiStreamTest.cpp (+1-1)
- (modified) llvm/unittests/Support/raw_ostream_test.cpp (+1-1)
- (modified) llvm/unittests/tools/llvm-exegesis/Mips/BenchmarkResultTest.cpp (+2-1)
- (modified) llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp (+1-1)
- (modified) llvm/utils/FileCheck/FileCheck.cpp (+3-2)
- (modified) llvm/utils/split-file/split-file.cpp (+1-1)
- (modified) mlir/lib/Support/FileUtilities.cpp (+1-1)
- (modified) mlir/lib/Target/LLVM/ROCDL/Target.cpp (+1-1)
- (modified) mlir/tools/mlir-pdll/mlir-pdll.cpp (+3-2)
- (modified) mlir/tools/mlir-src-sharder/mlir-src-sharder.cpp (+3-2)
``````````diff
diff --git a/clang-tools-extra/clang-include-fixer/FuzzySymbolIndex.cpp b/clang-tools-extra/clang-include-fixer/FuzzySymbolIndex.cpp
index 98987ad380196f..60842d95d0d024 100644
--- a/clang-tools-extra/clang-include-fixer/FuzzySymbolIndex.cpp
+++ b/clang-tools-extra/clang-include-fixer/FuzzySymbolIndex.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
#include "FuzzySymbolIndex.h"
+#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Regex.h"
using clang::find_all_symbols::SymbolAndSignals;
@@ -131,7 +132,8 @@ FuzzySymbolIndex::queryRegexp(const std::vector<std::string> &Tokens) {
llvm::Expected<std::unique_ptr<FuzzySymbolIndex>>
FuzzySymbolIndex::createFromYAML(StringRef FilePath) {
- auto Buffer = llvm::MemoryBuffer::getFile(FilePath, /*IsText=*/true);
+ auto Buffer =
+ llvm::MemoryBuffer::getFile(FilePath, llvm::sys::fs::OF_TextWithCRLF);
if (!Buffer)
return llvm::errorCodeToError(Buffer.getError());
return std::make_unique<MemSymbolIndex>(
diff --git a/clang-tools-extra/clang-include-fixer/YamlSymbolIndex.cpp b/clang-tools-extra/clang-include-fixer/YamlSymbolIndex.cpp
index 7f570ee917197b..3ab3daaf8dc32d 100644
--- a/clang-tools-extra/clang-include-fixer/YamlSymbolIndex.cpp
+++ b/clang-tools-extra/clang-include-fixer/YamlSymbolIndex.cpp
@@ -22,7 +22,7 @@ namespace include_fixer {
llvm::ErrorOr<std::unique_ptr<YamlSymbolIndex>>
YamlSymbolIndex::createFromFile(llvm::StringRef FilePath) {
- auto Buffer = llvm::MemoryBuffer::getFile(FilePath, /*IsText=*/true);
+ auto Buffer = llvm::MemoryBuffer::getFile(FilePath, sys::fs::OF_TextWithCRLF);
if (!Buffer)
return Buffer.getError();
diff --git a/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp b/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
index 995006e183569e..3a66c2d895ed9a 100644
--- a/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
+++ b/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
@@ -95,7 +95,8 @@ bool Merge(llvm::StringRef MergeDir, llvm::StringRef OutputFile) {
// Parse YAML files in parallel.
Pool.async(
[&AddSymbols](std::string Path) {
- auto Buffer = llvm::MemoryBuffer::getFile(Path, /*IsText=*/true);
+ auto Buffer =
+ llvm::MemoryBuffer::getFile(Path, sys::fs::OF_TextWithCRLF);
if (!Buffer) {
llvm::errs() << "Can't open " << Path << "\n";
return;
diff --git a/clang-tools-extra/clang-include-fixer/tool/ClangIncludeFixer.cpp b/clang-tools-extra/clang-include-fixer/tool/ClangIncludeFixer.cpp
index f983b9d590542e..386132c685c8ab 100644
--- a/clang-tools-extra/clang-include-fixer/tool/ClangIncludeFixer.cpp
+++ b/clang-tools-extra/clang-include-fixer/tool/ClangIncludeFixer.cpp
@@ -19,6 +19,7 @@
#include "clang/Tooling/Core/Replacement.h"
#include "clang/Tooling/Tooling.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/YAMLTraits.h"
@@ -413,7 +414,8 @@ int includeFixerMain(int argc, const char **argv) {
llvm::errs() << llvm::toString(InsertStyle.takeError()) << "\n";
return 1;
}
- auto Buffer = llvm::MemoryBuffer::getFile(FilePath, /*IsText=*/true);
+ auto Buffer =
+ llvm::MemoryBuffer::getFile(FilePath, sys::fs::OF_TextWithCRLF);
if (!Buffer) {
errs() << "Couldn't open file: " + FilePath.str() + ": "
<< Buffer.getError().message() + "\n";
diff --git a/clang-tools-extra/clang-tidy/misc/ConfusableTable/BuildConfusableTable.cpp b/clang-tools-extra/clang-tidy/misc/ConfusableTable/BuildConfusableTable.cpp
index ccabe31ea6b807..27f3e14bd30d08 100644
--- a/clang-tools-extra/clang-tidy/misc/ConfusableTable/BuildConfusableTable.cpp
+++ b/clang-tools-extra/clang-tidy/misc/ConfusableTable/BuildConfusableTable.cpp
@@ -10,6 +10,7 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/Support/ConvertUTF.h"
+#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
@@ -23,7 +24,7 @@ struct ConfusableEntry {
} // namespace
int main(int argc, char *argv[]) {
- auto ErrorOrBuffer = MemoryBuffer::getFile(argv[1], true);
+ auto ErrorOrBuffer = MemoryBuffer::getFile(argv[1], sys::fs::OF_TextWithCRLF);
if (!ErrorOrBuffer)
return 1;
std::unique_ptr<MemoryBuffer> Buffer = std::move(ErrorOrBuffer.get());
diff --git a/clang/lib/Driver/OffloadBundler.cpp b/clang/lib/Driver/OffloadBundler.cpp
index 2d0c326ab6f406..3935884e22f098 100644
--- a/clang/lib/Driver/OffloadBundler.cpp
+++ b/clang/lib/Driver/OffloadBundler.cpp
@@ -1025,7 +1025,7 @@ Error OffloadBundler::ListBundleIDsInFile(
// Open Input file.
ErrorOr<std::unique_ptr<MemoryBuffer>> Contents =
- MemoryBuffer::getFileOrSTDIN(InputFileName, /*IsText=*/true);
+ MemoryBuffer::getFileOrSTDIN(InputFileName, sys::fs::OF_TextWithCRLF);
if (std::error_code EC = Contents.getError())
return createFileError(InputFileName, EC);
@@ -1195,7 +1195,7 @@ Error OffloadBundler::BundleFiles() {
InputBuffers.reserve(BundlerConfig.InputFileNames.size());
for (auto &I : BundlerConfig.InputFileNames) {
ErrorOr<std::unique_ptr<MemoryBuffer>> CodeOrErr =
- MemoryBuffer::getFileOrSTDIN(I, /*IsText=*/true);
+ MemoryBuffer::getFileOrSTDIN(I, sys::fs::OF_TextWithCRLF);
if (std::error_code EC = CodeOrErr.getError())
return createFileError(I, EC);
InputBuffers.emplace_back(std::move(*CodeOrErr));
@@ -1265,7 +1265,7 @@ Error OffloadBundler::UnbundleFiles() {
// Open Input file.
ErrorOr<std::unique_ptr<MemoryBuffer>> CodeOrErr =
MemoryBuffer::getFileOrSTDIN(BundlerConfig.InputFileNames.front(),
- /*IsText=*/true);
+ sys::fs::OF_Text);
if (std::error_code EC = CodeOrErr.getError())
return createFileError(BundlerConfig.InputFileNames.front(), EC);
@@ -1493,7 +1493,8 @@ CheckHeterogeneousArchive(StringRef ArchiveName,
const OffloadBundlerConfig &BundlerConfig) {
std::vector<std::unique_ptr<MemoryBuffer>> ArchiveBuffers;
ErrorOr<std::unique_ptr<MemoryBuffer>> BufOrErr =
- MemoryBuffer::getFileOrSTDIN(ArchiveName, true, false);
+ MemoryBuffer::getFileOrSTDIN(ArchiveName, sys::fs::OF_TextWithCRLF,
+ false);
if (std::error_code EC = BufOrErr.getError())
return createFileError(ArchiveName, EC);
@@ -1588,7 +1589,7 @@ Error OffloadBundler::UnbundleArchive() {
}
ErrorOr<std::unique_ptr<MemoryBuffer>> BufOrErr =
- MemoryBuffer::getFileOrSTDIN(IFName, true, false);
+ MemoryBuffer::getFileOrSTDIN(IFName, sys::fs::OF_TextWithCRLF, false);
if (std::error_code EC = BufOrErr.getError())
return createFileError(BundlerConfig.InputFileNames.front(), EC);
diff --git a/clang/lib/ScalableStaticAnalysis/Core/Serialization/JSONFormat/JSONFormatImpl.cpp b/clang/lib/ScalableStaticAnalysis/Core/Serialization/JSONFormat/JSONFormatImpl.cpp
index b19849233f0f8f..9b89b057850f91 100644
--- a/clang/lib/ScalableStaticAnalysis/Core/Serialization/JSONFormat/JSONFormatImpl.cpp
+++ b/clang/lib/ScalableStaticAnalysis/Core/Serialization/JSONFormat/JSONFormatImpl.cpp
@@ -55,7 +55,8 @@ llvm::Expected<Value> readJSON(llvm::StringRef Path) {
.build();
}
- auto BufferOrError = llvm::MemoryBuffer::getFile(Path, /*IsText=*/true);
+ auto BufferOrError =
+ llvm::MemoryBuffer::getFile(Path, llvm::sys::fs::OF_TextWithCRLF);
if (!BufferOrError) {
const std::error_code EC = BufferOrError.getError();
return ErrorBuilder::create(EC, ErrorMessages::FailedToReadFile, Path,
diff --git a/clang/lib/Tooling/JSONCompilationDatabase.cpp b/clang/lib/Tooling/JSONCompilationDatabase.cpp
index 0efa75970d9864..0d8dbfac5d4b20 100644
--- a/clang/lib/Tooling/JSONCompilationDatabase.cpp
+++ b/clang/lib/Tooling/JSONCompilationDatabase.cpp
@@ -20,6 +20,7 @@
#include "llvm/Support/Allocator.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorOr.h"
+#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/StringSaver.h"
@@ -190,7 +191,7 @@ JSONCompilationDatabase::loadFromFile(StringRef FilePath,
JSONCommandLineSyntax Syntax) {
// Don't mmap: if we're a long-lived process, the build system may overwrite.
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> DatabaseBuffer =
- llvm::MemoryBuffer::getFile(FilePath, /*IsText=*/false,
+ llvm::MemoryBuffer::getFile(FilePath, llvm::sys::fs::OF_Text,
/*RequiresNullTerminator=*/true,
/*IsVolatile=*/true);
if (std::error_code Result = DatabaseBuffer.getError()) {
diff --git a/clang/tools/clang-format/ClangFormat.cpp b/clang/tools/clang-format/ClangFormat.cpp
index d465ed57f0033e..a89544a8ce7a7c 100644
--- a/clang/tools/clang-format/ClangFormat.cpp
+++ b/clang/tools/clang-format/ClangFormat.cpp
@@ -410,7 +410,7 @@ static bool format(StringRef FileName, bool ErrorOnIncompleteFormat = false) {
ErrorOr<std::unique_ptr<MemoryBuffer>> CodeOrErr =
!OutputXML && Inplace
? MemoryBuffer::getFileAsStream(FileName)
- : MemoryBuffer::getFileOrSTDIN(FileName, /*IsText=*/true);
+ : MemoryBuffer::getFileOrSTDIN(FileName, sys::fs::OF_TextWithCRLF);
if (std::error_code EC = CodeOrErr.getError()) {
errs() << FileName << ": " << EC.message() << "\n";
return true;
@@ -555,7 +555,7 @@ static int dumpConfig() {
// Read in the code in case the filename alone isn't enough to detect the
// language.
ErrorOr<std::unique_ptr<MemoryBuffer>> CodeOrErr =
- MemoryBuffer::getFileOrSTDIN(FileNames[0], /*IsText=*/true);
+ MemoryBuffer::getFileOrSTDIN(FileNames[0], sys::fs::OF_TextWithCRLF);
if (std::error_code EC = CodeOrErr.getError()) {
llvm::errs() << EC.message() << "\n";
return 1;
diff --git a/clang/tools/clang-scan-deps/ClangScanDeps.cpp b/clang/tools/clang-scan-deps/ClangScanDeps.cpp
index 778f73909665dc..453cc9018a5cee 100644
--- a/clang/tools/clang-scan-deps/ClangScanDeps.cpp
+++ b/clang/tools/clang-scan-deps/ClangScanDeps.cpp
@@ -318,14 +318,14 @@ class ResourceDirectoryCache {
};
if (llvm::sys::ExecuteAndWait(ClangBinaryPath, PrintResourceDirArgs, {},
Redirects)) {
- auto ErrorBuf =
- llvm::MemoryBuffer::getFile(ErrorFile.c_str(), /*IsText=*/true);
+ auto ErrorBuf = llvm::MemoryBuffer::getFile(
+ ErrorFile.c_str(), llvm::sys::fs::OF_TextWithCRLF);
llvm::errs() << ErrorBuf.get()->getBuffer();
return "";
}
- auto OutputBuf =
- llvm::MemoryBuffer::getFile(OutputFile.c_str(), /*IsText=*/true);
+ auto OutputBuf = llvm::MemoryBuffer::getFile(
+ OutputFile.c_str(), llvm::sys::fs::OF_TextWithCRLF);
if (!OutputBuf)
return "";
StringRef Output = OutputBuf.get()->getBuffer().rtrim('\n');
@@ -1114,8 +1114,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, /*IsText=*/true);
+ auto MaybeTU = llvm::MemoryBuffer::getFile(
+ TranslationUnitFile, llvm::sys::fs::OF_TextWithCRLF);
if (!MaybeTU) {
llvm::errs() << "cannot open input translation unit: "
<< MaybeTU.getError().message() << "\n";
diff --git a/clang/tools/driver/cc1as_main.cpp b/clang/tools/driver/cc1as_main.cpp
index 077cd69ce4e2ca..a24a205f9b04d6 100644
--- a/clang/tools/driver/cc1as_main.cpp
+++ b/clang/tools/driver/cc1as_main.cpp
@@ -442,7 +442,8 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
ErrorOr<std::unique_ptr<MemoryBuffer>> Buffer = [&] {
// FIXME(sandboxing): Make this a proper input file.
auto BypassSandbox = sys::sandbox::scopedDisable();
- return MemoryBuffer::getFileOrSTDIN(Opts.InputFile, /*IsText=*/true);
+ return MemoryBuffer::getFileOrSTDIN(Opts.InputFile,
+ sys::fs::OF_TextWithCRLF);
}();
if (std::error_code EC = Buffer.getError()) {
diff --git a/clang/unittests/ScalableStaticAnalysis/Serialization/JSONFormatTest/JSONFormatTest.cpp b/clang/unittests/ScalableStaticAnalysis/Serialization/JSONFormatTest/JSONFormatTest.cpp
index 777625dc9fed7e..9454171bdbf4be 100644
--- a/clang/unittests/ScalableStaticAnalysis/Serialization/JSONFormatTest/JSONFormatTest.cpp
+++ b/clang/unittests/ScalableStaticAnalysis/Serialization/JSONFormatTest/JSONFormatTest.cpp
@@ -123,7 +123,8 @@ bool JSONFormatTest::permissionsAreEnforced() const {
// silently suppressing the test.
}
- auto Buffer = llvm::MemoryBuffer::getFile(ProbePath, /*IsText=*/true);
+ auto Buffer =
+ llvm::MemoryBuffer::getFile(ProbePath, llvm::sys::fs::OF_TextWithCRLF);
bool Enforced = !Buffer; // If open failed, permissions are enforced.
// Restore permissions so TearDown can clean up the temp directory.
@@ -137,7 +138,8 @@ llvm::Expected<llvm::json::Value>
JSONFormatTest::readJSONFromFile(llvm::StringRef FileName) const {
PathString FilePath = makePath(FileName);
- auto BufferOrError = llvm::MemoryBuffer::getFile(FilePath, /*IsText=*/true);
+ auto BufferOrError =
+ llvm::MemoryBuffer::getFile(FilePath, llvm::sys::fs::OF_TextWithCRLF);
if (!BufferOrError) {
return llvm::createStringError(BufferOrError.getError(),
"Failed to read file: %s", FilePath.c_str());
diff --git a/clang/unittests/Serialization/PreambleInNamedModulesTest.cpp b/clang/unittests/Serialization/PreambleInNamedModulesTest.cpp
index b826f20ce4d70e..3ed48fa2668e92 100644
--- a/clang/unittests/Serialization/PreambleInNamedModulesTest.cpp
+++ b/clang/unittests/Serialization/PreambleInNamedModulesTest.cpp
@@ -93,7 +93,7 @@ export using ::E;
ASSERT_TRUE(Invocation);
llvm::ErrorOr<std::unique_ptr<MemoryBuffer>> ContentsBuffer =
- llvm::MemoryBuffer::getFile(MainFilePath, /*IsText=*/true);
+ llvm::MemoryBuffer::getFile(MainFilePath, sys::fs::OF_TextWithCRLF);
EXPECT_TRUE(ContentsBuffer);
std::unique_ptr<MemoryBuffer> Buffer = std::move(*ContentsBuffer);
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index ecbb5e9fff4e19..b468672dfaa4ee 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -164,7 +164,7 @@ static std::future<MBErrPair> createFutureForFile(std::string path,
auto strategy = std::launch::deferred;
#endif
return std::async(strategy, [=]() {
- auto mbOrErr = MemoryBuffer::getFile(path, /*IsText=*/false,
+ auto mbOrErr = MemoryBuffer::getFile(path, sys::fs::OF_None,
/*RequiresNullTerminator=*/false);
if (!mbOrErr)
return MBErrPair{nullptr, mbOrErr.getError()};
@@ -422,7 +422,7 @@ void LinkerDriver::enqueuePath(StringRef path, bool lazy, InputOpt inputOpt) {
// before something we can find with an architecture, we won't find the
// winsysroot file.
if (std::optional<StringRef> retryPath = findFileIfNew(pathStr)) {
- auto retryMb = MemoryBuffer::getFile(*retryPath, /*IsText=*/false,
+ auto retryMb = MemoryBuffer::getFile(*retryPath, sys::fs::OF_None,
/*RequiresNullTerminator=*/false);
ec = retryMb.getError();
if (!ec) {
@@ -1114,7 +1114,7 @@ void LinkerDriver::createImportLibrary(bool asLib) {
// If the import library already exists, replace it only if the contents
// have changed.
ErrorOr<std::unique_ptr<MemoryBuffer>> oldBuf = MemoryBuffer::getFile(
- path, /*IsText=*/false, /*RequiresNullTerminator=*/false);
+ path, sys::fs::OF_None, /*RequiresNullTerminator=*/false);
if (!oldBuf) {
checkError(writeImportLibrary(libName, path, exports, ctx.config.machine,
ctx.config.mingw, nativeExports));
@@ -1135,7 +1135,7 @@ void LinkerDriver::createImportLibrary(bool asLib) {
}
std::unique_ptr<MemoryBuffer> newBuf = check(MemoryBuffer::getFile(
- tmpName, /*IsText=*/false, /*RequiresNullTerminator=*/false));
+ tmpName, sys::fs::OF_None, /*RequiresNullTerminator=*/false));
if ((*oldBuf)->getBuffer() != newBuf->getBuffer()) {
oldBuf->reset();
checkError(errorCodeToError(sys::fs::rename(tmpName, path)));
@@ -1181,7 +1181,7 @@ void LinkerDriver::parseOrderFile(StringRef arg) {
// Open a file.
StringRef path = arg.substr(1);
std::unique_ptr<MemoryBuffer> mb =
- CHECK(MemoryBuffer::getFile(path, /*IsText=*/false,
+ CHECK(MemoryBuffer::getFile(path, sys::fs::OF_None,
/*RequiresNullTerminator=*/false,
/*IsVolatile=*/true),
"could not open " + path);
@@ -1209,7 +1209,7 @@ void LinkerDriver::parseOrderFile(StringRef arg) {
void LinkerDriver::parseCallGraphFile(StringRef path) {
std::unique_ptr<MemoryBuffer> mb =
- CHECK(MemoryBuffer::getFile(path, /*IsText=*/false,
+ CHECK(MemoryBuffer::getFile(path, sys::fs::OF_None,
/*RequiresNullTerminator=*/false,
/*IsVolatile=*/true),
"could not open " + path);
diff --git a/lld/COFF/DriverUtils.cpp b/lld/COFF/DriverUtils.cpp
index 265ddee6d85572..220183ec9d7a92 100644
--- a/lld/COFF/DriverUtils.cpp
+++ b/lld/COFF/DriverUtils.cpp
@@ -421,7 +421,7 @@ class TemporaryFile {
// is called (you cannot remove an opened file on Windows.)
std::unique_ptr<MemoryBuffer> getMemoryBuffer() {
// IsVolatile=true forces MemoryBuffer to not use mmap().
- return CHECK(MemoryBuffer::getFile(path, /*IsText=*/false,
+ return CHECK(MemoryBuffer::getFile(path, sys::fs::OF_None,
/*RequiresNullTerminator=*/false,
/*IsVolatile=*/true),
"could not open " + path);
diff --git a/lld/COFF/SymbolTable.cpp b/lld/COFF/SymbolTable.cpp
index ea5bdbc0be4890..400d02899f1fc5 100644
--- a/lld/COFF/SymbolTable.cpp
+++ b/lld/COFF/SymbolTable.cpp
@@ -1336,7 +1336,7 @@ void SymbolTable::assignExportOrdinals() {
void SymbolTable::parseModuleDefs(StringRef path) {
llvm::TimeTraceScope timeScope("Parse def file");
std::unique_ptr<MemoryBuffer> mb =
- CHECK(MemoryBuffer::getFile(path, /*IsText=*/false,
+ CHECK(MemoryBuffer::getFile(path, sys::fs::OF_None,
/*RequiresNullTerminator=*/false,
/*IsVolatile=*/true),
"could not open " + path);
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index 4af0898cef6078..7759458e93944b 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -245,7 +245,7 @@ std::optional<MemoryBufferRef> elf::readFile(Ctx &ctx, StringRef path) {
Log(ctx) << path;
ctx.arg.dependencyFiles.insert(llvm::CachedHashString(path));
- auto mbOrErr = MemoryBuffer::getFile(path, /*IsText=*/false,
+ auto mbOrErr = MemoryBuffer::getFile(path, sys::fs::OF_None,
/*RequiresNullTerminator=*/false);
if (auto ec = mbOrErr.getError()) {
ErrAlways(ctx) << "cannot open " << path << ": " << ec.message();
diff --git a/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp b/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp
index 840169c563a9c8..93abafcfc96478 100644
--- a/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp
+++ b/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp
@@ -175,7 +175,7 @@ ObjectFilePDB::loadPDBFile(std::string PdbPath,
if (ec || magic != llvm::file_magic::pdb)
return nullptr;
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> ErrorOrBuffer =
- llvm::MemoryBuffer::getFile(PdbPath, /*IsText=*/false,
+ llvm::MemoryBuffer::getFile(PdbPath, llvm::sys::fs::OF_None,
...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/228437
More information about the llvm-commits
mailing list