-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[SystemZ][z/OS] Add new openFileForReadBinary function, and pass IsText parameter to getBufferForFile #111723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,8 +117,9 @@ FileSystem::~FileSystem() = default; | |
|
||
ErrorOr<std::unique_ptr<MemoryBuffer>> | ||
FileSystem::getBufferForFile(const llvm::Twine &Name, int64_t FileSize, | ||
bool RequiresNullTerminator, bool IsVolatile) { | ||
auto F = openFileForRead(Name); | ||
bool RequiresNullTerminator, bool IsVolatile, | ||
bool IsText) { | ||
auto F = IsText ? openFileForRead(Name) : openFileForReadBinary(Name); | ||
if (!F) | ||
return F.getError(); | ||
|
||
|
@@ -279,6 +280,8 @@ class RealFileSystem : public FileSystem { | |
|
||
ErrorOr<Status> status(const Twine &Path) override; | ||
ErrorOr<std::unique_ptr<File>> openFileForRead(const Twine &Path) override; | ||
ErrorOr<std::unique_ptr<File>> | ||
openFileForReadBinary(const Twine &Path) override; | ||
directory_iterator dir_begin(const Twine &Dir, std::error_code &EC) override; | ||
|
||
llvm::ErrorOr<std::string> getCurrentWorkingDirectory() const override; | ||
|
@@ -302,6 +305,17 @@ class RealFileSystem : public FileSystem { | |
return Storage; | ||
} | ||
|
||
ErrorOr<std::unique_ptr<File>> openFileForRead(const Twine &Name, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, Could you mark this as static. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think I'm able to mark it static because it calls adjustPath which is non-static There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. np. I was misreading the diff. I didn't see it was a private member function. It looked like a file scope function. I was thinking file scope static, not static member.
abhina-sree marked this conversation as resolved.
Show resolved
Hide resolved
|
||
sys::fs::OpenFlags Flags) { | ||
SmallString<256> RealName, Storage; | ||
Expected<file_t> FDOrErr = sys::fs::openNativeFileForRead( | ||
adjustPath(Name, Storage), Flags, &RealName); | ||
if (!FDOrErr) | ||
return errorToErrorCode(FDOrErr.takeError()); | ||
return std::unique_ptr<File>( | ||
new RealFile(*FDOrErr, Name.str(), RealName.str())); | ||
} | ||
|
||
struct WorkingDirectory { | ||
// The current working directory, without symlinks resolved. (echo $PWD). | ||
SmallString<128> Specified; | ||
|
@@ -324,13 +338,12 @@ ErrorOr<Status> RealFileSystem::status(const Twine &Path) { | |
|
||
ErrorOr<std::unique_ptr<File>> | ||
RealFileSystem::openFileForRead(const Twine &Name) { | ||
SmallString<256> RealName, Storage; | ||
Expected<file_t> FDOrErr = sys::fs::openNativeFileForRead( | ||
adjustPath(Name, Storage), sys::fs::OF_None, &RealName); | ||
if (!FDOrErr) | ||
return errorToErrorCode(FDOrErr.takeError()); | ||
return std::unique_ptr<File>( | ||
new RealFile(*FDOrErr, Name.str(), RealName.str())); | ||
return openFileForRead(Name, sys::fs::OF_Text); | ||
} | ||
|
||
ErrorOr<std::unique_ptr<File>> | ||
RealFileSystem::openFileForReadBinary(const Twine &Name) { | ||
return openFileForRead(Name, sys::fs::OF_None); | ||
} | ||
|
||
llvm::ErrorOr<std::string> RealFileSystem::getCurrentWorkingDirectory() const { | ||
|
Uh oh!
There was an error while loading. Please reload this page.