[lld] r307044 - fix msvc build
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 3 10:32:09 PDT 2017
Author: rafael
Date: Mon Jul 3 10:32:09 2017
New Revision: 307044
URL: http://llvm.org/viewvc/llvm-project?rev=307044&view=rev
Log:
fix msvc build
Modified:
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=307044&r1=307043&r2=307044&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Mon Jul 3 10:32:09 2017
@@ -1147,18 +1147,19 @@ static void removeUnusedSyntheticSection
continue;
OutputSectionCommand *Cmd = Script->getCmd(OS);
- BaseCommand **Empty = nullptr;
- for (BaseCommand *&B : Cmd->Commands) {
+ std::vector<BaseCommand *>::iterator Empty = Cmd->Commands.end();
+ for (auto I = Cmd->Commands.begin(), E = Cmd->Commands.end(); I != E; ++I) {
+ BaseCommand *B = *I;
if (auto *ISD = dyn_cast<InputSectionDescription>(B)) {
- auto I = std::find(ISD->Sections.begin(), ISD->Sections.end(), SS);
- if (I != ISD->Sections.end())
- ISD->Sections.erase(I);
+ auto P = std::find(ISD->Sections.begin(), ISD->Sections.end(), SS);
+ if (P != ISD->Sections.end())
+ ISD->Sections.erase(P);
if (ISD->Sections.empty())
- Empty = &B;
+ Empty = I;
}
}
- if (Empty)
- Cmd->Commands.erase(std::vector<BaseCommand *>::iterator(Empty));
+ if (Empty != Cmd->Commands.end())
+ Cmd->Commands.erase(Empty);
// If there are no other sections in the output section, remove it from the
// output.
More information about the llvm-commits
mailing list