[llvm] [SystemZ][z/OS] Open YAML files for read as text files (PR #121340)
Zibi Sarbinowski via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 30 06:12:49 PST 2024
https://github.com/zibi2 created https://github.com/llvm/llvm-project/pull/121340
This patch makes sure YAML files are opened for reading as text file to trigger auto-conversion from EBCDIC encoding into expected ASCII encoding on z/OS platform. This is required to fix the following lit tests:
```
LLVM :: tools/llvm-gsymutil/ARM_AArch64/macho-gsym-callsite-info-exe.yaml
LLVM :: tools/llvm-gsymutil/ARM_AArch64/macho-gsym-callsite-info-obj.test
LLVM :: tools/llvm-gsymutil/ARM_AArch64/macho-gsym-callsite-info-dsym.yaml
LLVM :: Transforms/PGOProfile/memprof_undrift_missing_leaf.ll
```
>From 8ba723fab145bc83abfe1d19cb1b47632513a2c4 Mon Sep 17 00:00:00 2001
From: Zbigniew Sarbinowski <zibi at ca.ibm.com>
Date: Mon, 30 Dec 2024 13:53:13 +0000
Subject: [PATCH] YAML files should be open for read as text files
---
llvm/lib/DebugInfo/GSYM/CallSiteInfo.cpp | 2 +-
llvm/lib/ProfileData/MemProfReader.cpp | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/llvm/lib/DebugInfo/GSYM/CallSiteInfo.cpp b/llvm/lib/DebugInfo/GSYM/CallSiteInfo.cpp
index 85b41e28991316..c112c0bc3ddc9d 100644
--- a/llvm/lib/DebugInfo/GSYM/CallSiteInfo.cpp
+++ b/llvm/lib/DebugInfo/GSYM/CallSiteInfo.cpp
@@ -151,7 +151,7 @@ LLVM_YAML_IS_SEQUENCE_VECTOR(FunctionYAML)
Error CallSiteInfoLoader::loadYAML(StringRef YAMLFile) {
// Step 1: Read YAML file
- auto BufferOrError = MemoryBuffer::getFile(YAMLFile);
+ auto BufferOrError = MemoryBuffer::getFile(YAMLFile, /*IsText=*/true);
if (!BufferOrError)
return errorCodeToError(BufferOrError.getError());
diff --git a/llvm/lib/ProfileData/MemProfReader.cpp b/llvm/lib/ProfileData/MemProfReader.cpp
index 10c36f25c4b795..6a4fecd5ae05e8 100644
--- a/llvm/lib/ProfileData/MemProfReader.cpp
+++ b/llvm/lib/ProfileData/MemProfReader.cpp
@@ -754,7 +754,7 @@ Error RawMemProfReader::readNextRecord(
Expected<std::unique_ptr<YAMLMemProfReader>>
YAMLMemProfReader::create(const Twine &Path) {
- auto BufferOr = MemoryBuffer::getFileOrSTDIN(Path);
+ auto BufferOr = MemoryBuffer::getFileOrSTDIN(Path, /*IsText=*/true);
if (std::error_code EC = BufferOr.getError())
return report(errorCodeToError(EC), Path.getSingleStringRef());
@@ -770,7 +770,7 @@ YAMLMemProfReader::create(std::unique_ptr<MemoryBuffer> Buffer) {
}
bool YAMLMemProfReader::hasFormat(const StringRef Path) {
- auto BufferOr = MemoryBuffer::getFileOrSTDIN(Path);
+ auto BufferOr = MemoryBuffer::getFileOrSTDIN(Path, /*IsText=*/true);
if (!BufferOr)
return false;
More information about the llvm-commits
mailing list