Skip to content

Commit d55ec63

Browse files
author
George Rimar
committed
[ELF] - Simplify code. NFC.
Just use getDataAs for taking sections contents. llvm-svn: 336892
1 parent d31c478 commit d55ec63

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

lld/ELF/Writer.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,8 +1375,7 @@ static bool isDuplicateArmExidxSec(InputSection *Prev, InputSection *Cur) {
13751375
};
13761376

13771377
// Get the last table Entry from the previous .ARM.exidx section.
1378-
const ExidxEntry &PrevEntry = *reinterpret_cast<const ExidxEntry *>(
1379-
Prev->Data.data() + Prev->getSize() - sizeof(ExidxEntry));
1378+
const ExidxEntry &PrevEntry = Prev->getDataAs<ExidxEntry>().back();
13801379
if (IsExtabRef(PrevEntry.Unwind))
13811380
return false;
13821381

@@ -1388,10 +1387,7 @@ static bool isDuplicateArmExidxSec(InputSection *Prev, InputSection *Cur) {
13881387
// consecutive identical entries are rare and the effort to check that they
13891388
// are identical is high.
13901389

1391-
ArrayRef<const ExidxEntry> Entries(
1392-
reinterpret_cast<const ExidxEntry *>(Cur->Data.data()),
1393-
Cur->getSize() / sizeof(ExidxEntry));
1394-
for (const ExidxEntry &Entry : Entries)
1390+
for (const ExidxEntry Entry : Cur->getDataAs<ExidxEntry>())
13951391
if (IsExtabRef(Entry.Unwind) || Entry.Unwind != PrevEntry.Unwind)
13961392
return false;
13971393
// All table entries in this .ARM.exidx Section can be merged into the

0 commit comments

Comments
 (0)