[clang] [llvm] [SystemZ][z/OS] Add new openFileForReadBinary function, and pass IsText parameter to getBufferForFile (PR #111723)

kadir çetinkaya via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 10 07:31:37 PDT 2024


================
@@ -271,15 +271,24 @@ class FileSystem : public llvm::ThreadSafeRefCountedBase<FileSystem>,
   /// Get the status of the entry at \p Path, if one exists.
   virtual llvm::ErrorOr<Status> status(const Twine &Path) = 0;
 
-  /// Get a \p File object for the file at \p Path, if one exists.
+  /// Get a \p File object for the text file at \p Path, if one exists.
   virtual llvm::ErrorOr<std::unique_ptr<File>>
   openFileForRead(const Twine &Path) = 0;
 
+  /// Get a \p File objct for the binary file at \p Path, if one exists.
+  /// This function should be called instead of openFileForRead if the file
+  /// should be opened as a binary file.
----------------
kadircet wrote:

can you rather explain the motiviating use case? e.g. "Some filesystems can perform modifications to bytes on-disk when reading as test. Reading as binary ensures contents are received as-is in such cases, on most file systems this is same as `openFileForRead`".

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


More information about the cfe-commits mailing list