diff options
| author | George Rimar <grimar@accesssoftek.com> | 2017-04-05 09:19:29 +0000 |
|---|---|---|
| committer | George Rimar <grimar@accesssoftek.com> | 2017-04-05 09:19:29 +0000 |
| commit | 07d7c42c5d4ce7bedf23fe805931e633d554d206 (patch) | |
| tree | 2afac5a086c5ba8e044c4780722b839ca863ac44 /lld/ELF/LinkerScript.cpp | |
| parent | a8d2451533644df9ea0108a6aab5a303d208a5e0 (diff) | |
| download | bcm5719-llvm-07d7c42c5d4ce7bedf23fe805931e633d554d206.tar.gz bcm5719-llvm-07d7c42c5d4ce7bedf23fe805931e633d554d206.zip | |
Revert r299506 "Simplify. NFC."
It was not NFC unfortunaly,
one of changes decrements begin() iterator and
that is not allowed by MSVS.
llvm-svn: 299525
Diffstat (limited to 'lld/ELF/LinkerScript.cpp')
| -rw-r--r-- | lld/ELF/LinkerScript.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 230a69d73fb..924a0f370e7 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -354,14 +354,17 @@ void LinkerScript::processCommands(OutputSectionFactory &Factory) { CurOutSec = Aether; Dot = 0; - for (auto It = Opt.Commands.begin(); It != Opt.Commands.end(); ++It) { + for (unsigned I = 0; I < Opt.Commands.size(); ++I) { + auto Iter = Opt.Commands.begin() + I; + BaseCommand *Base1 = *Iter; + // Handle symbol assignments outside of any output section. - if (auto *Cmd = dyn_cast<SymbolAssignment>(*It)) { + if (auto *Cmd = dyn_cast<SymbolAssignment>(Base1)) { addSymbol(Cmd); continue; } - if (auto *Cmd = dyn_cast<OutputSectionCommand>(*It)) { + if (auto *Cmd = dyn_cast<OutputSectionCommand>(Base1)) { std::vector<InputSectionBase *> V = createInputSectionList(*Cmd); // The output section name `/DISCARD/' is special. @@ -374,15 +377,15 @@ void LinkerScript::processCommands(OutputSectionFactory &Factory) { // This is for ONLY_IF_RO and ONLY_IF_RW. An output section directive // ".foo : ONLY_IF_R[OW] { ... }" is handled only if all member input // sections satisfy a given constraint. If not, a directive is handled - // as if it weren't present from the beginning. + // as if it wasn't present from the beginning. // // Because we'll iterate over Commands many more times, the easiest - // way to "make it as if it weren't present" is to just remove it. + // way to "make it as if it wasn't present" is to just remove it. if (!matchConstraints(V, Cmd->Constraint)) { for (InputSectionBase *S : V) S->Assigned = false; - --It; - Opt.Commands.erase(It + 1); + Opt.Commands.erase(Iter); + --I; continue; } |

