Remove unnecessary local variable.
This patch does what r299506 was trying to do in a different way.
llvm-svn: 299554
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 924a0f3..9e39a5de 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -354,17 +354,14 @@
CurOutSec = Aether;
Dot = 0;
- for (unsigned I = 0; I < Opt.Commands.size(); ++I) {
- auto Iter = Opt.Commands.begin() + I;
- BaseCommand *Base1 = *Iter;
-
+ for (size_t I = 0; I < Opt.Commands.size(); ++I) {
// Handle symbol assignments outside of any output section.
- if (auto *Cmd = dyn_cast<SymbolAssignment>(Base1)) {
+ if (auto *Cmd = dyn_cast<SymbolAssignment>(Opt.Commands[I])) {
addSymbol(Cmd);
continue;
}
- if (auto *Cmd = dyn_cast<OutputSectionCommand>(Base1)) {
+ if (auto *Cmd = dyn_cast<OutputSectionCommand>(Opt.Commands[I])) {
std::vector<InputSectionBase *> V = createInputSectionList(*Cmd);
// The output section name `/DISCARD/' is special.
@@ -384,7 +381,7 @@
if (!matchConstraints(V, Cmd->Constraint)) {
for (InputSectionBase *S : V)
S->Assigned = false;
- Opt.Commands.erase(Iter);
+ Opt.Commands.erase(Opt.Commands.begin() + I);
--I;
continue;
}