Skip to content

Commit

Permalink
[ELF] Remove unneeded null check in getRelocatedSection. NFC
Browse files Browse the repository at this point in the history
  • Loading branch information
MaskRay committed Mar 20, 2024
1 parent 456c239 commit 09db84c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lld/ELF/InputSection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,9 @@ InputSection::InputSection(InputFile *f, uint64_t flags, uint32_t type,
StringRef name, Kind k)
: InputSectionBase(f, flags, type,
/*Entsize*/ 0, /*Link*/ 0, /*Info*/ 0, addralign, data,
name, k) {}
name, k) {
assert(f || this == &InputSection::discarded);
}

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

InputSectionBase *InputSection::getRelocatedSection() const {
if (!file || file->isInternal() || (type != SHT_RELA && type != SHT_REL))
if (file->isInternal() || (type != SHT_RELA && type != SHT_REL))
return nullptr;
ArrayRef<InputSectionBase *> sections = file->getSections();
return sections[info];
Expand Down

0 comments on commit 09db84c

Please sign in to comment.