Skip to content

Commit 09db84c

Browse files
committed
[ELF] Remove unneeded null check in getRelocatedSection. NFC
1 parent 456c239 commit 09db84c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lld/ELF/InputSection.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,9 @@ InputSection::InputSection(InputFile *f, uint64_t flags, uint32_t type,
316316
StringRef name, Kind k)
317317
: InputSectionBase(f, flags, type,
318318
/*Entsize*/ 0, /*Link*/ 0, /*Info*/ 0, addralign, data,
319-
name, k) {}
319+
name, k) {
320+
assert(f || this == &InputSection::discarded);
321+
}
320322

321323
template <class ELFT>
322324
InputSection::InputSection(ObjFile<ELFT> &f, const typename ELFT::Shdr &header,
@@ -346,7 +348,7 @@ template <class ELFT> void InputSection::copyShtGroup(uint8_t *buf) {
346348
}
347349

348350
InputSectionBase *InputSection::getRelocatedSection() const {
349-
if (!file || file->isInternal() || (type != SHT_RELA && type != SHT_REL))
351+
if (file->isInternal() || (type != SHT_RELA && type != SHT_REL))
350352
return nullptr;
351353
ArrayRef<InputSectionBase *> sections = file->getSections();
352354
return sections[info];

0 commit comments

Comments
 (0)