mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
[SystemZ][z/OS] Add IsText Argument to GetFile and GetFileOrSTDIN
Add the `IsText` argument to `GetFile` and `GetFileOrSTDIN` which will help z/OS distinguish between text and binary correctly. This is an extension to [this patch](https://reviews.llvm.org/D97785) Reviewed By: abhina.sreeskantharajan, amccarth Differential Revision: https://reviews.llvm.org/D100488
This commit is contained in:
parent
76d74ee926
commit
738bd4dca6
@ -104,7 +104,7 @@ parseAssemblyFileWithIndex(StringRef Filename, SMDiagnostic &Err,
|
||||
bool UpgradeDebugInfo,
|
||||
DataLayoutCallbackTy DataLayoutCallback) {
|
||||
ErrorOr<std::unique_ptr<MemoryBuffer>> FileOrErr =
|
||||
MemoryBuffer::getFileOrSTDIN(Filename);
|
||||
MemoryBuffer::getFileOrSTDIN(Filename, /*IsText=*/true);
|
||||
if (std::error_code EC = FileOrErr.getError()) {
|
||||
Err = SMDiagnostic(Filename, SourceMgr::DK_Error,
|
||||
"Could not open input file: " + EC.message());
|
||||
|
@ -984,7 +984,7 @@ bool MIRParser::parseMachineFunctions(Module &M, MachineModuleInfo &MMI) {
|
||||
std::unique_ptr<MIRParser> llvm::createMIRParserFromFile(
|
||||
StringRef Filename, SMDiagnostic &Error, LLVMContext &Context,
|
||||
std::function<void(Function &)> ProcessIRFunction) {
|
||||
auto FileOrErr = MemoryBuffer::getFileOrSTDIN(Filename);
|
||||
auto FileOrErr = MemoryBuffer::getFileOrSTDIN(Filename, /*IsText=*/true);
|
||||
if (std::error_code EC = FileOrErr.getError()) {
|
||||
Error = SMDiagnostic(Filename, SourceMgr::DK_Error,
|
||||
"Could not open input file: " + EC.message());
|
||||
|
@ -41,7 +41,7 @@ using namespace llvm;
|
||||
static Expected<std::unique_ptr<MemoryBuffer>>
|
||||
setupMemoryBuffer(const Twine &Path) {
|
||||
ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr =
|
||||
MemoryBuffer::getFileOrSTDIN(Path);
|
||||
MemoryBuffer::getFileOrSTDIN(Path, /*IsText=*/true);
|
||||
if (std::error_code EC = BufferOrErr.getError())
|
||||
return errorCodeToError(EC);
|
||||
return std::move(BufferOrErr.get());
|
||||
|
@ -1575,7 +1575,7 @@ SampleProfileReaderItaniumRemapper::lookUpNameInProfile(StringRef Fname) {
|
||||
/// \returns an error code indicating the status of the buffer.
|
||||
static ErrorOr<std::unique_ptr<MemoryBuffer>>
|
||||
setupMemoryBuffer(const Twine &Filename) {
|
||||
auto BufferOrErr = MemoryBuffer::getFileOrSTDIN(Filename);
|
||||
auto BufferOrErr = MemoryBuffer::getFileOrSTDIN(Filename, /*IsText=*/true);
|
||||
if (std::error_code EC = BufferOrErr.getError())
|
||||
return EC;
|
||||
auto Buffer = std::move(BufferOrErr.get());
|
||||
|
@ -40,7 +40,7 @@ SmallString<128> llvm::unittest::getInputFileDirectory(const char *Argv0) {
|
||||
|
||||
EXPECT_TRUE(Found) << "Unit test source directory file does not exist.";
|
||||
|
||||
auto File = MemoryBuffer::getFile(InputFilePath);
|
||||
auto File = MemoryBuffer::getFile(InputFilePath, /*IsText=*/true);
|
||||
|
||||
EXPECT_TRUE(static_cast<bool>(File))
|
||||
<< "Could not open unit test source directory file.";
|
||||
|
@ -334,7 +334,7 @@ namespace exegesis {
|
||||
Expected<InstructionBenchmark>
|
||||
InstructionBenchmark::readYaml(const LLVMState &State, StringRef Filename) {
|
||||
if (auto ExpectedMemoryBuffer =
|
||||
errorOrToExpected(MemoryBuffer::getFile(Filename))) {
|
||||
errorOrToExpected(MemoryBuffer::getFile(Filename, /*IsText=*/true))) {
|
||||
yaml::Input Yin(*ExpectedMemoryBuffer.get());
|
||||
YamlContext Context(State);
|
||||
InstructionBenchmark Benchmark;
|
||||
@ -351,7 +351,7 @@ InstructionBenchmark::readYaml(const LLVMState &State, StringRef Filename) {
|
||||
Expected<std::vector<InstructionBenchmark>>
|
||||
InstructionBenchmark::readYamls(const LLVMState &State, StringRef Filename) {
|
||||
if (auto ExpectedMemoryBuffer =
|
||||
errorOrToExpected(MemoryBuffer::getFile(Filename))) {
|
||||
errorOrToExpected(MemoryBuffer::getFile(Filename, /*IsText=*/true))) {
|
||||
yaml::Input Yin(*ExpectedMemoryBuffer.get());
|
||||
YamlContext Context(State);
|
||||
std::vector<InstructionBenchmark> Benchmarks;
|
||||
|
@ -182,7 +182,7 @@ template <> struct MappingTraits<IFSStub> {
|
||||
static Expected<std::unique_ptr<IFSStub>> readInputFile(StringRef FilePath) {
|
||||
// Read in file.
|
||||
ErrorOr<std::unique_ptr<MemoryBuffer>> BufOrError =
|
||||
MemoryBuffer::getFileOrSTDIN(FilePath);
|
||||
MemoryBuffer::getFileOrSTDIN(FilePath, /*IsText=*/true);
|
||||
if (!BufOrError)
|
||||
return createStringError(BufOrError.getError(), "Could not open `%s`",
|
||||
FilePath.data());
|
||||
|
@ -343,7 +343,7 @@ int main(int argc, char **argv) {
|
||||
Triple TheTriple(TripleName);
|
||||
|
||||
ErrorOr<std::unique_ptr<MemoryBuffer>> BufferPtr =
|
||||
MemoryBuffer::getFileOrSTDIN(InputFilename);
|
||||
MemoryBuffer::getFileOrSTDIN(InputFilename, /*IsText=*/true);
|
||||
if (std::error_code EC = BufferPtr.getError()) {
|
||||
WithColor::error(errs(), ProgName)
|
||||
<< InputFilename << ": " << EC.message() << '\n';
|
||||
|
Loading…
Reference in New Issue
Block a user