Simplify. NFC.
llvm-svn: 296619
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index caf6fcb..a73bfe7 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -434,7 +434,8 @@
}
template <class ELFT> void LinkerScript<ELFT>::flush() {
- if (!CurOutSec || !AlreadyOutputOS.insert(CurOutSec).second)
+ assert(CurOutSec);
+ if (!AlreadyOutputOS.insert(CurOutSec).second)
return;
for (InputSection *I : CurOutSec->Sections)
output(I);
@@ -446,7 +447,6 @@
if (AlreadyOutputOS.count(Sec))
return;
- flush();
CurOutSec = Sec;
Dot = alignTo(Dot, CurOutSec->Addralign);
@@ -484,23 +484,19 @@
// calculates and assigns the offsets for each section and also
// updates the output section size.
auto &ICmd = cast<InputSectionDescription>(Base);
- for (InputSectionBase *ID : ICmd.Sections) {
+ for (InputSectionBase *IB : ICmd.Sections) {
// We tentatively added all synthetic sections at the beginning and removed
// empty ones afterwards (because there is no way to know whether they were
// going be empty or not other than actually running linker scripts.)
// We need to ignore remains of empty sections.
- if (auto *Sec = dyn_cast<SyntheticSection>(ID))
+ if (auto *Sec = dyn_cast<SyntheticSection>(IB))
if (Sec->empty())
continue;
- auto *IB = static_cast<InputSectionBase *>(ID);
if (!IB->Live)
continue;
switchTo(IB->OutSec);
- if (auto *I = dyn_cast<InputSection>(IB))
- output(I);
- else
- flush();
+ output(cast<InputSection>(IB));
}
}