[ELF] Remove unneeded null check in getRelocatedSection. NFC
GitOrigin-RevId: 09db84cc5910a3546ab5b9410c295d93ed3e95cf
diff --git a/ELF/InputSection.cpp b/ELF/InputSection.cpp
index 19a6595..082e840 100644
--- a/ELF/InputSection.cpp
+++ b/ELF/InputSection.cpp
@@ -316,7 +316,9 @@
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,
@@ -346,7 +348,7 @@
}
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];