[PATCH] D46896: [llvm-objcopy] Add --strip-unneeded option

Paul Semel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 24 13:05:34 PDT 2018


paulsemel added inline comments.


================
Comment at: tools/llvm-objcopy/Object.cpp:261
+  return const_cast<Symbol *>(
+      static_cast<const SymbolTableSection *>(this)->getSymbolByIndex(Index));
+}
----------------
alexshap wrote:
> probably you don't need the "internal" cast static_cast<const SymbolTableSection *>(this), do you ? 
I'm sorry, but I don't see how I can do this differently. A bit of help would be appreciated.
If I do not `static_cast` this, I will self call, no ?


================
Comment at: tools/llvm-objcopy/Object.cpp:950
 
+void Object::markSymbols() {
+  for (const SecPtr &Sec : Sections)
----------------
jakehehrlich wrote:
> This can be done externally via a loop over `sections()`. I'd like to keep the exposed methods as simple as possible.
Alright, I'll strip this function :)


================
Comment at: tools/llvm-objcopy/Object.h:632
   void removeSymbols(function_ref<bool(const Symbol &)> ToRemove);
+  void markSymbols();
   template <class T, class... Ts> T &addSection(Ts &&... Args) {
----------------
alexshap wrote:
> missing override ?
Actually no, this method has the same name as the markSymbols BaseSection method, but is different (I should I named it differently, anyway, @jakehehrlich wants me to remove it, so no more issues :) )


Repository:
  rL LLVM

https://reviews.llvm.org/D46896





More information about the llvm-commits mailing list