aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/MemoryBuffer.cpp
diff options
context:
space:
mode:
authorAbhina Sree <Abhina.Sreeskantharajan@ibm.com>2025-06-11 15:26:49 -0400
committerGitHub <noreply@github.com>2025-06-11 15:26:49 -0400
commit22fd11fe66a0d64f5ef359e21ae67a7d40936eaf (patch)
treec76f8f2b6b8662eddafe502733a7a12658a78621 /llvm/lib/Support/MemoryBuffer.cpp
parent5dafe9dca867b90f20dcd71c620ad823aee4262b (diff)
downloadllvm-22fd11fe66a0d64f5ef359e21ae67a7d40936eaf.zip
llvm-22fd11fe66a0d64f5ef359e21ae67a7d40936eaf.tar.gz
llvm-22fd11fe66a0d64f5ef359e21ae67a7d40936eaf.tar.bz2
[SystemZ][z/OS] Refactor AutoConvert.h to remove large MVS guard (#143174)
This AutoConvert.h header frequently gets mislabeled as an unused include because it is guarded by MVS internally and every usage is also guarded. This refactors the change to remove this guard and instead make these functions a noop on other non-z/OS platforms.
Diffstat (limited to 'llvm/lib/Support/MemoryBuffer.cpp')
-rw-r--r--llvm/lib/Support/MemoryBuffer.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/Support/MemoryBuffer.cpp b/llvm/lib/Support/MemoryBuffer.cpp
index e2044bc..601f11f 100644
--- a/llvm/lib/Support/MemoryBuffer.cpp
+++ b/llvm/lib/Support/MemoryBuffer.cpp
@@ -15,6 +15,7 @@
#include "llvm/ADT/SmallString.h"
#include "llvm/Config/config.h"
#include "llvm/Support/Alignment.h"
+#include "llvm/Support/AutoConvert.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
@@ -34,9 +35,6 @@
#include <io.h>
#endif
-#ifdef __MVS__
-#include "llvm/Support/AutoConvert.h"
-#endif
using namespace llvm;
//===----------------------------------------------------------------------===//
@@ -508,15 +506,15 @@ getOpenFileImpl(sys::fs::file_t FD, const Twine &Filename, uint64_t FileSize,
}
#ifdef __MVS__
- ErrorOr<bool> NeedConversion = needzOSConversion(Filename.str().c_str(), FD);
- if (std::error_code EC = NeedConversion.getError())
+ ErrorOr<bool> NeedsConversion = needConversion(Filename.str().c_str(), FD);
+ if (std::error_code EC = NeedsConversion.getError())
return EC;
// File size may increase due to EBCDIC -> UTF-8 conversion, therefore we
// cannot trust the file size and we create the memory buffer by copying
// off the stream.
// Note: This only works with the assumption of reading a full file (i.e,
// Offset == 0 and MapSize == FileSize). Reading a file slice does not work.
- if (Offset == 0 && MapSize == FileSize && *NeedConversion)
+ if (*NeedsConversion && Offset == 0 && MapSize == FileSize)
return getMemoryBufferForStream(FD, Filename);
#endif