Skip to content

[llvm-objdump] Remove unnecessary casts (NFC) #152443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions llvm/tools/llvm-objdump/MachODump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1749,7 +1749,7 @@ static void DumpLiteralPointerSection(MachOObjectFile *O,

StringRef BytesStr = unwrapOrError(Sect->getContents(), O->getFileName());

const char *Contents = reinterpret_cast<const char *>(BytesStr.data());
const char *Contents = BytesStr.data();

switch (section_type) {
case MachO::S_CSTRING_LITERALS:
Expand Down Expand Up @@ -1965,7 +1965,7 @@ static void DumpSectionContents(StringRef Filename, MachOObjectFile *O,

StringRef BytesStr =
unwrapOrError(Section.getContents(), O->getFileName());
const char *sect = reinterpret_cast<const char *>(BytesStr.data());
const char *sect = BytesStr.data();
uint32_t sect_size = BytesStr.size();
uint64_t sect_addr = Section.getAddress();

Expand Down Expand Up @@ -2049,7 +2049,7 @@ static void DumpInfoPlistSectionContents(StringRef Filename,
outs() << "Contents of (" << SegName << "," << SectName << ") section\n";
StringRef BytesStr =
unwrapOrError(Section.getContents(), O->getFileName());
const char *sect = reinterpret_cast<const char *>(BytesStr.data());
const char *sect = BytesStr.data();
outs() << format("%.*s", BytesStr.size(), sect) << "\n";
return;
}
Expand Down Expand Up @@ -3237,7 +3237,7 @@ static const char *GuessCstringPointer(uint64_t ReferenceValue,
uint64_t object_offset = Sec.offset + sect_offset;
StringRef MachOContents = info->O->getData();
uint64_t object_size = MachOContents.size();
const char *object_addr = (const char *)MachOContents.data();
const char *object_addr = MachOContents.data();
if (object_offset < object_size) {
const char *name = object_addr + object_offset;
return name;
Expand All @@ -3258,7 +3258,7 @@ static const char *GuessCstringPointer(uint64_t ReferenceValue,
uint64_t object_offset = Sec.offset + sect_offset;
StringRef MachOContents = info->O->getData();
uint64_t object_size = MachOContents.size();
const char *object_addr = (const char *)MachOContents.data();
const char *object_addr = MachOContents.data();
if (object_offset < object_size) {
const char *name = object_addr + object_offset;
return name;
Expand Down Expand Up @@ -3447,7 +3447,7 @@ static uint64_t GuessPointerPointer(uint64_t ReferenceValue,
uint64_t object_offset = Sec.offset + sect_offset;
StringRef MachOContents = info->O->getData();
uint64_t object_size = MachOContents.size();
const char *object_addr = (const char *)MachOContents.data();
const char *object_addr = MachOContents.data();
if (object_offset < object_size) {
uint64_t pointer_value;
memcpy(&pointer_value, object_addr + object_offset,
Expand Down Expand Up @@ -4350,7 +4350,7 @@ walk_pointer_list_64(const char *listname, const SectionRef S,
outs() << "Contents of (" << SegName << "," << SectName << ") section\n";

StringRef BytesStr = unwrapOrError(S.getContents(), O->getFileName());
const char *Contents = reinterpret_cast<const char *>(BytesStr.data());
const char *Contents = BytesStr.data();

for (uint32_t i = 0; i < S.getSize(); i += sizeof(uint64_t)) {
uint32_t left = S.getSize() - i;
Expand Down Expand Up @@ -4399,7 +4399,7 @@ walk_pointer_list_32(const char *listname, const SectionRef S,
outs() << "Contents of (" << SegName << "," << SectName << ") section\n";

StringRef BytesStr = unwrapOrError(S.getContents(), O->getFileName());
const char *Contents = reinterpret_cast<const char *>(BytesStr.data());
const char *Contents = BytesStr.data();

for (uint32_t i = 0; i < S.getSize(); i += sizeof(uint32_t)) {
uint32_t left = S.getSize() - i;
Expand Down