[llvm] [SystemZ][z/OS] Query if a file is text and set the text flag accordingly (PR #109664)

kadir çetinkaya via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 24 07:22:44 PDT 2024


================
@@ -52,6 +52,12 @@ std::error_code restorezOSStdHandleAutoConversion(int FD);
 /// \brief Set the tag information for a file descriptor.
 std::error_code setzOSFileTag(int FD, int CCSID, bool Text);
 
+// Get the the tag ccsid for a file name or a file descriptor.
+ErrorOr<__ccsid_t> getzOSFileTag(const char *FileName, const int FD = -1);
+
+// Query the file tag to determine if the file is a text file.
+ErrorOr<bool> iszOSTextFile(const char *Filename, const int FD = -1);
----------------
kadircet wrote:

do you expect callers to ever have the ability to handle returned error ? if not maybe we can just return a bool, saying `false` in the failure case?

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


More information about the llvm-commits mailing list