summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2017-03-01 14:12:21 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2017-03-01 14:12:21 +0000
commitbd12e2a0ce31b385d1147b319b3fa092e6bb9bb1 (patch)
treed4ae4251f834171fdb04d22d0c4df9b554189007
parent90573e49c938b8c94621c65c64cf2b7e72c37c01 (diff)
downloadbcm5719-llvm-bd12e2a0ce31b385d1147b319b3fa092e6bb9bb1.tar.gz
bcm5719-llvm-bd12e2a0ce31b385d1147b319b3fa092e6bb9bb1.zip
Simplify. NFC.
llvm-svn: 296619
-rw-r--r--lld/ELF/LinkerScript.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index caf6fcb643f..a73bfe700f5 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -434,7 +434,8 @@ template <class ELFT> void LinkerScript<ELFT>::output(InputSection *S) {
}
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 @@ template <class ELFT> void LinkerScript<ELFT>::switchTo(OutputSection *Sec) {
if (AlreadyOutputOS.count(Sec))
return;
- flush();
CurOutSec = Sec;
Dot = alignTo(Dot, CurOutSec->Addralign);
@@ -484,23 +484,19 @@ template <class ELFT> void LinkerScript<ELFT>::process(BaseCommand &Base) {
// 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));
}
}
OpenPOWER on IntegriCloud