aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-objcopy/ELF/Object.cpp
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-03-29 08:08:20 +0000
committerFangrui Song <maskray@google.com>2019-03-29 08:08:20 +0000
commit5ed0a8bf1393ebbd13bf985dc30818b215e3288e (patch)
tree015d9f358f6391b247ebf3d2dbdc1dfe09e2e3bb /llvm/tools/llvm-objcopy/ELF/Object.cpp
parent421c09427a3ae8c8d06e1a63536ee4a72cef6f01 (diff)
downloadllvm-5ed0a8bf1393ebbd13bf985dc30818b215e3288e.zip
llvm-5ed0a8bf1393ebbd13bf985dc30818b215e3288e.tar.gz
llvm-5ed0a8bf1393ebbd13bf985dc30818b215e3288e.tar.bz2
[llvm-objcopy] Delete two redundant reinterpret_cast. NFC
llvm-svn: 357238
Diffstat (limited to 'llvm/tools/llvm-objcopy/ELF/Object.cpp')
-rw-r--r--llvm/tools/llvm-objcopy/ELF/Object.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/tools/llvm-objcopy/ELF/Object.cpp b/llvm/tools/llvm-objcopy/ELF/Object.cpp
index 7cceb70..43c0564 100644
--- a/llvm/tools/llvm-objcopy/ELF/Object.cpp
+++ b/llvm/tools/llvm-objcopy/ELF/Object.cpp
@@ -171,8 +171,7 @@ getDecompressedSizeAndAlignment(ArrayRef<uint8_t> Data) {
const bool IsGnuDebug = isDataGnuCompressed(Data);
const uint64_t DecompressedSize =
IsGnuDebug
- ? support::endian::read64be(reinterpret_cast<const uint64_t *>(
- Data.data() + ZlibGnuMagic.size()))
+ ? support::endian::read64be(Data.data() + ZlibGnuMagic.size())
: reinterpret_cast<const Elf_Chdr_Impl<ELFT> *>(Data.data())->ch_size;
const uint64_t DecompressedAlign =
IsGnuDebug ? 1
@@ -742,12 +741,11 @@ GnuDebugLinkSection::GnuDebugLinkSection(StringRef File) : FileName(File) {
template <class ELFT>
void ELFSectionWriter<ELFT>::visit(const GnuDebugLinkSection &Sec) {
- auto Buf = Out.getBufferStart() + Sec.Offset;
- char *File = reinterpret_cast<char *>(Buf);
+ unsigned char *Buf = Out.getBufferStart() + Sec.Offset;
Elf_Word *CRC =
reinterpret_cast<Elf_Word *>(Buf + Sec.Size - sizeof(Elf_Word));
*CRC = Sec.CRC32;
- llvm::copy(Sec.FileName, File);
+ llvm::copy(Sec.FileName, Buf);
}
void GnuDebugLinkSection::accept(SectionVisitor &Visitor) const {