[lld] r278465 - Early continue. NFC.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 11 20:33:04 PDT 2016
Author: ruiu
Date: Thu Aug 11 22:33:04 2016
New Revision: 278465
URL: http://llvm.org/viewvc/llvm-project?rev=278465&view=rev
Log:
Early continue. NFC.
Modified:
lld/trunk/ELF/LinkerScript.cpp
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=278465&r1=278464&r2=278465&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Thu Aug 11 22:33:04 2016
@@ -242,6 +242,12 @@ LinkerScript<ELFT>::createInputSectionLi
template <class ELFT>
void LinkerScript<ELFT>::createSections(OutputSectionFactory<ELFT> &Factory) {
for (const std::unique_ptr<BaseCommand> &Base1 : Opt.Commands) {
+ if (auto *Cmd = dyn_cast<SymbolAssignment>(Base1.get())) {
+ if (shouldDefine<ELFT>(Cmd))
+ addRegular<ELFT>(Cmd);
+ continue;
+ }
+
if (auto *Cmd = dyn_cast<OutputSectionCommand>(Base1.get())) {
if (Cmd->Name == "/DISCARD/") {
discard(*Cmd);
@@ -260,9 +266,6 @@ void LinkerScript<ELFT>::createSections(
OutputSections->push_back(OutSec);
for (InputSectionBase<ELFT> *Sec : V)
OutSec->addSection(Sec);
- } else if (auto *Cmd2 = dyn_cast<SymbolAssignment>(Base1.get())) {
- if (shouldDefine<ELFT>(Cmd2))
- addRegular<ELFT>(Cmd2);
}
}
@@ -270,14 +273,14 @@ void LinkerScript<ELFT>::createSections(
for (const std::unique_ptr<ObjectFile<ELFT>> &F :
Symtab<ELFT>::X->getObjectFiles()) {
for (InputSectionBase<ELFT> *S : F->getSections()) {
- if (!isDiscarded(S) && !S->OutSec) {
- OutputSectionBase<ELFT> *OutSec;
- bool IsNew;
- std::tie(OutSec, IsNew) = Factory.create(S, getOutputSectionName(S));
- if (IsNew)
- OutputSections->push_back(OutSec);
- OutSec->addSection(S);
- }
+ if (isDiscarded(S) || S->OutSec)
+ continue;
+ OutputSectionBase<ELFT> *OutSec;
+ bool IsNew;
+ std::tie(OutSec, IsNew) = Factory.create(S, getOutputSectionName(S));
+ if (IsNew)
+ OutputSections->push_back(OutSec);
+ OutSec->addSection(S);
}
}
More information about the llvm-commits
mailing list