Skip to content

Commit 5ed0a8b

Browse files
committed
[llvm-objcopy] Delete two redundant reinterpret_cast. NFC
llvm-svn: 357238
1 parent 421c094 commit 5ed0a8b

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

llvm/tools/llvm-objcopy/ELF/Object.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,7 @@ getDecompressedSizeAndAlignment(ArrayRef<uint8_t> Data) {
171171
const bool IsGnuDebug = isDataGnuCompressed(Data);
172172
const uint64_t DecompressedSize =
173173
IsGnuDebug
174-
? support::endian::read64be(reinterpret_cast<const uint64_t *>(
175-
Data.data() + ZlibGnuMagic.size()))
174+
? support::endian::read64be(Data.data() + ZlibGnuMagic.size())
176175
: reinterpret_cast<const Elf_Chdr_Impl<ELFT> *>(Data.data())->ch_size;
177176
const uint64_t DecompressedAlign =
178177
IsGnuDebug ? 1
@@ -742,12 +741,11 @@ GnuDebugLinkSection::GnuDebugLinkSection(StringRef File) : FileName(File) {
742741

743742
template <class ELFT>
744743
void ELFSectionWriter<ELFT>::visit(const GnuDebugLinkSection &Sec) {
745-
auto Buf = Out.getBufferStart() + Sec.Offset;
746-
char *File = reinterpret_cast<char *>(Buf);
744+
unsigned char *Buf = Out.getBufferStart() + Sec.Offset;
747745
Elf_Word *CRC =
748746
reinterpret_cast<Elf_Word *>(Buf + Sec.Size - sizeof(Elf_Word));
749747
*CRC = Sec.CRC32;
750-
llvm::copy(Sec.FileName, File);
748+
llvm::copy(Sec.FileName, Buf);
751749
}
752750

753751
void GnuDebugLinkSection::accept(SectionVisitor &Visitor) const {

0 commit comments

Comments
 (0)