[PATCH] D46341: [llvm-objcopy] Add --discard-all (-x) option
Jake Ehrlich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 1 18:51:37 PDT 2018
jakehehrlich added inline comments.
================
Comment at: tools/llvm-objcopy/Object.cpp:197-202
auto Iter =
std::remove_if(std::begin(Symbols), std::end(Symbols),
[=](const SymPtr &Sym) { return Sym->DefinedIn == Sec; });
Size -= (std::end(Symbols) - Iter) * this->EntrySize;
Symbols.erase(Iter, std::end(Symbols));
assignIndices();
----------------
Can you implement this in terms of removeSymbols?
================
Comment at: tools/llvm-objcopy/Object.cpp:217
+ Symbols.erase(std::remove_if(std::begin(Symbols), std::end(Symbols),
+ [&ToRemove](std::unique_ptr<Symbol> &Ptr) {
+ return ToRemove(*Ptr);
----------------
Can you capture ToRemove by value? Capturing by reference just adds a layer of indirection. Also can you use const SymPtr& for the type?
================
Comment at: tools/llvm-objcopy/Object.cpp:221-222
+ std::end(Symbols));
+ size_t RemovedElements = OldSize - Symbols.size();
+ Size -= (RemovedElements * EntrySize);
+
----------------
Size = Symbols.size() * EntrySize
Repository:
rL LLVM
https://reviews.llvm.org/D46341
More information about the llvm-commits
mailing list