[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 10:33:20 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:

This is because previously OF_None was being passed at this point unconditionally. In Path.inc in functions (like openNativeFileForRead(...), openFile(...), etc) we do not modify the OpenFlags and respect the flags that were passed. So it would seem wrong to pass OF_None here (which implies a binary file) and then decide it is a text file later on in the code path.

https://github.com/llvm/llvm-project/pull/109664


More information about the llvm-commits mailing list