diff options
author | Abhina Sree <Abhina.Sreeskantharajan@ibm.com> | 2025-07-02 10:02:46 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-02 10:02:46 -0400 |
commit | a9ee1797b716fa61f495a2400f95da4594a8ae80 (patch) | |
tree | f1d4b557aac202162998fa6888e6735f0699480c /clang/lib/Basic | |
parent | fc00256b2b4d7a5328b775b51240258e0d28701c (diff) | |
download | llvm-a9ee1797b716fa61f495a2400f95da4594a8ae80.zip llvm-a9ee1797b716fa61f495a2400f95da4594a8ae80.tar.gz llvm-a9ee1797b716fa61f495a2400f95da4594a8ae80.tar.bz2 |
Remove helper function and use target agnostic needConversion function (#146680)
This patch adds back the needed AutoConvert.h header and removes the
unneeded include guard of MVS to prevent this header from being removed
in the future
Diffstat (limited to 'clang/lib/Basic')
-rw-r--r-- | clang/lib/Basic/SourceManager.cpp | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp index 8209642..1b4be14 100644 --- a/clang/lib/Basic/SourceManager.cpp +++ b/clang/lib/Basic/SourceManager.cpp @@ -24,6 +24,7 @@ #include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/Support/Allocator.h" +#include "llvm/Support/AutoConvert.h" #include "llvm/Support/Capacity.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Endian.h" @@ -586,17 +587,6 @@ SourceManager::getOrCreateFileID(FileEntryRef SourceFile, FileCharacter); } -/// Helper function to determine if an input file requires conversion -bool needConversion(StringRef Filename) { -#ifdef __MVS__ - llvm::ErrorOr<bool> NeedConversion = - llvm::needzOSConversion(Filename.str().c_str()); - return NeedConversion && *NeedConversion; -#else - return false; -#endif -} - /// createFileID - Create a new FileID for the specified ContentCache and /// include position. This works regardless of whether the ContentCache /// corresponds to a file or some other input source. @@ -616,8 +606,9 @@ FileID SourceManager::createFileIDImpl(ContentCache &File, StringRef Filename, return FileID::get(LoadedID); } unsigned FileSize = File.getSize(); - bool NeedConversion = needConversion(Filename); - if (NeedConversion) { + llvm::ErrorOr<bool> NeedConversion = + llvm::needConversion(Filename.str().c_str()); + if (NeedConversion && *NeedConversion) { // Buffer size may increase due to potential z/OS EBCDIC to UTF-8 // conversion. if (std::optional<llvm::MemoryBufferRef> Buffer = |