[llvm] [SystemZ][z/OS] Query if a file is text and set the text flag accordingly (PR #109664)
Abhina Sree via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 24 08:41:10 PDT 2024
================
@@ -325,8 +325,15 @@ ErrorOr<Status> RealFileSystem::status(const Twine &Path) {
ErrorOr<std::unique_ptr<File>>
RealFileSystem::openFileForRead(const Twine &Name) {
SmallString<256> RealName, Storage;
+ auto OpenFlags = sys::fs::OF_None;
+#ifdef __MVS__
+ // If the file is tagged with a text ccsid, it may require autoconversion.
----------------
abhina-sree wrote:
So automatic conversion is a z/OS specific functionality to help ASCII applications work on z/OS. The native encoding on z/OS is EBCDIC, not ASCII-based, so without this tool enabled, we aren't able to read files correctly. This is some documentation on this feature: https://www.ibm.com/docs/en/zos/3.1.0?topic=pages-enhanced-ascii
There are also other places that do require distinguishing between text and binary files as well, there were many places that were modified in the past for example https://reviews.llvm.org/D99426.
But since the openFileForRead() function mainly deals with reading existing files, so querying the file tag seems sufficient to determining whether its binary or text based instead of passing an IsText parameter based on where it was called from.
https://github.com/llvm/llvm-project/pull/109664
More information about the llvm-commits
mailing list