[lld] r299554 - Remove unnecessary local variable.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 5 09:07:44 PDT 2017
Author: ruiu
Date: Wed Apr 5 11:07:44 2017
New Revision: 299554
URL: http://llvm.org/viewvc/llvm-project?rev=299554&view=rev
Log:
Remove unnecessary local variable.
This patch does what r299506 was trying to do in a different way.
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=299554&r1=299553&r2=299554&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Wed Apr 5 11:07:44 2017
@@ -354,17 +354,14 @@ void LinkerScript::processCommands(Outpu
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 @@ void LinkerScript::processCommands(Outpu
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;
}
More information about the llvm-commits
mailing list