[PATCH] D15327: [ELF] - Implemented --print-gc-sections command line argument.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 9 02:47:15 PST 2015


grimar added inline comments.

================
Comment at: ELF/Writer.cpp:537
@@ -534,1 +536,3 @@
 template <class ELFT>
+bool Writer<ELFT>::reportDiscarded(
+    InputSectionBase<ELFT> *IS,
----------------
ruiu wrote:
> If a function does not refer any member variable of a class, non-member function is preferred over member function.
Done.

================
Comment at: ELF/Writer.cpp:541-542
@@ +540,4 @@
+  if (Config->PrintGcSections && IS && !IS->isLive())
+    warning(Twine("removing unused section from '") + IS->getSectionName() +
+            "' in file '" + File->getName() + "'");
+  return true;
----------------
ruiu wrote:
> Since this is not a warning, don't use warning(). Instead, write the message out to llvm::errs().
Done.
I thought about adding message() method to error.h/cpp for such cases.
But then file name would not be consistent with content, since message is not an error.

================
Comment at: ELF/Writer.cpp:579-580
@@ -566,4 +578,4 @@
     for (InputSectionBase<ELFT> *C : F->getSections()) {
-      if (isDiscarded(C))
+      if (isDiscarded(C) && reportDiscarded(C, F))
         continue;
       const Elf_Shdr *H = C->getSectionHdr();
----------------
ruiu wrote:
>   if (isDiscarded(C)) {
>     reportDiscarded(C, F);
>     continue;
>   }
Done.


http://reviews.llvm.org/D15327





More information about the llvm-commits mailing list