Skip to content

Commit e6c4fc7

Browse files
committed
[LLD][COFF][NFC] Use dyn_cast on section chunks
Instead of dyn_cast_or_null, chunk pointers are never null.
1 parent b953914 commit e6c4fc7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lld/COFF/Writer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ bool Writer::createThunks(OutputSection *os, int margin) {
472472
// Recheck Chunks.size() each iteration, since we can insert more
473473
// elements into it.
474474
for (size_t i = 0; i != os->chunks.size(); ++i) {
475-
SectionChunk *sc = dyn_cast_or_null<SectionChunk>(os->chunks[i]);
475+
SectionChunk *sc = dyn_cast<SectionChunk>(os->chunks[i]);
476476
if (!sc)
477477
continue;
478478
MachineTypes machine = sc->getMachine();
@@ -606,7 +606,7 @@ void Writer::createECCodeMap() {
606606
// Verify that all relocations are in range, with no extra margin requirements.
607607
bool Writer::verifyRanges(const std::vector<Chunk *> chunks) {
608608
for (Chunk *c : chunks) {
609-
SectionChunk *sc = dyn_cast_or_null<SectionChunk>(c);
609+
SectionChunk *sc = dyn_cast<SectionChunk>(c);
610610
if (!sc)
611611
continue;
612612
MachineTypes machine = sc->getMachine();
@@ -872,8 +872,8 @@ bool Writer::fixGnuImportChunks() {
872872
if (!pSec->chunks.empty())
873873
hasIdata = true;
874874
llvm::stable_sort(pSec->chunks, [&](Chunk *s, Chunk *t) {
875-
SectionChunk *sc1 = dyn_cast_or_null<SectionChunk>(s);
876-
SectionChunk *sc2 = dyn_cast_or_null<SectionChunk>(t);
875+
SectionChunk *sc1 = dyn_cast<SectionChunk>(s);
876+
SectionChunk *sc2 = dyn_cast<SectionChunk>(t);
877877
if (!sc1 || !sc2) {
878878
// if SC1, order them ascending. If SC2 or both null,
879879
// S is not less than T.

0 commit comments

Comments
 (0)