Skip to content

Commit

Permalink
[SystemZ][z/OS] Open YAML files for read as text files (#121340)
Browse files Browse the repository at this point in the history
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
```
zibi2 authored Dec 31, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 80ecbaa commit 1d51546
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion llvm/lib/DebugInfo/GSYM/CallSiteInfo.cpp
Original file line number Diff line number Diff line change
@@ -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());

4 changes: 2 additions & 2 deletions llvm/lib/ProfileData/MemProfReader.cpp
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit 1d51546

Please sign in to comment.