[PATCH] D37520: [ELF] - Fix removing of unused synthetic sections.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 8 15:56:52 PDT 2017
ruiu added inline comments.
================
Comment at: ELF/Writer.cpp:1204
- std::vector<BaseCommand *>::iterator Empty = OS->Commands.end();
- for (auto I = OS->Commands.begin(), E = OS->Commands.end(); I != E; ++I) {
- BaseCommand *B = *I;
- if (auto *ISD = dyn_cast<InputSectionDescription>(B)) {
+ // Remove unused synthetic section.
+ for (BaseCommand *B : OS->Commands)
----------------
// SS is an unused synthetic section. Remove it from output section commands.
================
Comment at: ELF/Writer.cpp:1205-1208
+ for (BaseCommand *B : OS->Commands)
+ if (auto *ISD = dyn_cast<InputSectionDescription>(B))
llvm::erase_if(ISD->Sections,
[=](InputSection *IS) { return IS == SS; });
----------------
This code still looks odd. Can SS belong to more than one OS->Commands?
================
Comment at: ELF/Writer.cpp:1210
- // If there are no other sections in the output section, remove it from the
- // output.
+ // Remove whole section description commands if them became empty.
+ llvm::erase_if(OS->Commands, [](BaseCommand *B) {
----------------
Please fix grammatical errors.
https://reviews.llvm.org/D37520
More information about the llvm-commits
mailing list