Skip to content

Commit 355476c

Browse files
authored
Merge branch 'main' into perry/fix-lit-tests-zos
2 parents 68f0149 + 3d2efe7 commit 355476c

File tree

6 files changed

+10
-11
lines changed

6 files changed

+10
-11
lines changed

clang/lib/Basic/SourceManager.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,8 +608,7 @@ FileID SourceManager::createFileIDImpl(ContentCache &File, StringRef Filename,
608608
return FileID::get(LoadedID);
609609
}
610610
unsigned FileSize = File.getSize();
611-
llvm::ErrorOr<bool> NeedConversion =
612-
llvm::needConversion(Filename.str().c_str());
611+
llvm::ErrorOr<bool> NeedConversion = llvm::needConversion(Filename);
613612
if (NeedConversion && *NeedConversion) {
614613
// Buffer size may increase due to potential z/OS EBCDIC to UTF-8
615614
// conversion.

llvm/include/llvm/Support/AutoConvert.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <_Ccsid.h>
1919
#endif
2020
#ifdef __cplusplus
21+
#include "llvm/ADT/Twine.h"
2122
#include "llvm/Support/Error.h"
2223
#include <system_error>
2324
#endif /* __cplusplus */
@@ -47,12 +48,12 @@ namespace llvm {
4748
std::error_code setzOSFileTag(int FD, int CCSID, bool Text);
4849

4950
/** \brief Get the the tag ccsid for a file name or a file descriptor. */
50-
ErrorOr<__ccsid_t> getzOSFileTag(const char *FileName, const int FD = -1);
51+
ErrorOr<__ccsid_t> getzOSFileTag(const Twine &FileName, const int FD = -1);
5152

5253
/** \brief Query the file tag to determine if it needs conversion to UTF-8
5354
* codepage.
5455
*/
55-
ErrorOr<bool> needzOSConversion(const char *FileName, const int FD = -1);
56+
ErrorOr<bool> needzOSConversion(const Twine &FileName, const int FD = -1);
5657

5758
#endif /* __MVS__*/
5859

@@ -87,7 +88,7 @@ inline std::error_code setFileTag(int FD, int CCSID, bool Text) {
8788
return std::error_code();
8889
}
8990

90-
inline ErrorOr<bool> needConversion(const char *FileName, const int FD = -1) {
91+
inline ErrorOr<bool> needConversion(const Twine &FileName, const int FD = -1) {
9192
#ifdef __MVS__
9293
return needzOSConversion(FileName, FD);
9394
#endif

llvm/lib/Support/AutoConvert.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ std::error_code llvm::setzOSFileTag(int FD, int CCSID, bool Text) {
9696
return std::error_code();
9797
}
9898

99-
ErrorOr<__ccsid_t> llvm::getzOSFileTag(const char *FileName, const int FD) {
99+
ErrorOr<__ccsid_t> llvm::getzOSFileTag(const Twine &FileName, const int FD) {
100100
// If we have a file descriptor, use it to find out file tagging. Otherwise we
101101
// need to use stat() with the file path.
102102
if (FD != -1) {
@@ -110,12 +110,12 @@ ErrorOr<__ccsid_t> llvm::getzOSFileTag(const char *FileName, const int FD) {
110110
return Query.fccsid;
111111
}
112112
struct stat Attr;
113-
if (stat(FileName, &Attr) == -1)
113+
if (stat(FileName.str().c_str(), &Attr) == -1)
114114
return std::error_code(errno, std::generic_category());
115115
return Attr.st_tag.ft_ccsid;
116116
}
117117

118-
ErrorOr<bool> llvm::needzOSConversion(const char *FileName, const int FD) {
118+
ErrorOr<bool> llvm::needzOSConversion(const Twine &FileName, const int FD) {
119119
ErrorOr<__ccsid_t> Ccsid = getzOSFileTag(FileName, FD);
120120
if (std::error_code EC = Ccsid.getError())
121121
return EC;

llvm/lib/Support/MemoryBuffer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ getOpenFileImpl(sys::fs::file_t FD, const Twine &Filename, uint64_t FileSize,
512512
}
513513

514514
#ifdef __MVS__
515-
ErrorOr<bool> NeedsConversion = needConversion(Filename.str().c_str(), FD);
515+
ErrorOr<bool> NeedsConversion = needConversion(Filename, FD);
516516
if (std::error_code EC = NeedsConversion.getError())
517517
return EC;
518518
// File size may increase due to EBCDIC -> UTF-8 conversion, therefore we

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12213,7 +12213,7 @@ static int matchShuffleAsShift(MVT &ShiftVT, unsigned &Opcode,
1221312213
MVT ShiftSVT = MVT::getIntegerVT(ScalarSizeInBits * Scale);
1221412214
ShiftVT = ByteShift ? MVT::getVectorVT(MVT::i8, SizeInBits / 8)
1221512215
: MVT::getVectorVT(ShiftSVT, Size / Scale);
12216-
return (int)ShiftAmt;
12216+
return ShiftAmt;
1221712217
};
1221812218

1221912219
// SSE/AVX supports logical shifts up to 64-bit integers - so we can just

llvm/lib/Transforms/Instrumentation/MemProfUse.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ static void HandleUnsupportedAnnotationKinds(GlobalVariable &GVar,
216216
}
217217
LLVM_DEBUG(dbgs() << "Skip annotation for " << GVar.getName() << " due to "
218218
<< Reason << ".\n");
219-
return;
220219
}
221220

222221
struct AllocMatchInfo {

0 commit comments

Comments
 (0)