diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2017-07-03 17:32:09 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2017-07-03 17:32:09 +0000 |
commit | 43ee36040d31c5dc2852a22cad2a30d1ee97baa7 (patch) | |
tree | e02c364769d89cba0ee2557ffcd59697ebd58ea1 | |
parent | c080ff64dc05a0940082f3a9f4be0258ed70210f (diff) | |
download | bcm5719-llvm-43ee36040d31c5dc2852a22cad2a30d1ee97baa7.tar.gz bcm5719-llvm-43ee36040d31c5dc2852a22cad2a30d1ee97baa7.zip |
fix msvc build
llvm-svn: 307044
-rw-r--r-- | lld/ELF/Writer.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 3a8af2d4021..6df49269db8 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -1147,18 +1147,19 @@ static void removeUnusedSyntheticSections() { 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. |