[PATCH] D23868: [ELF] - Introduce DiscardPolicy instead of 3 relative bool fields.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 30 08:03:41 PDT 2016


grimar added inline comments.

================
Comment at: ELF/Config.h:33-37
@@ -32,5 +32,7 @@
 
 enum class BuildIdKind { None, Fnv1, Md5, Sha1, Hexstring };
 
 enum class UnresolvedPolicy { NoUndef, Error, Warn, Ignore };
 
+enum class DiscardPolicy { Default, All, Locals, None };
+
----------------
ruiu wrote:
> They need comments.
> 
>   // For --build-id.
>   // For --unresolved-symbols.
>   // For --discard-{all,locals}.
Done.

================
Comment at: ELF/Config.h:84
@@ -83,3 +84,1 @@
-  bool DiscardLocals;
-  bool DiscardNone;
   bool EhFrameHdr;
----------------
ruiu wrote:
> I couldn't find --discard-none in GNU ld manual. Where did this come from?
According to gold changelog file it is fresh option:

2015-06-04  Cary Coutant  <ccoutant at gmail.com>
	PR gold/17498
...
	(--discard-none): New option.
...

================
Comment at: ELF/Driver.cpp:352-357
@@ +351,8 @@
+    return DiscardPolicy::Default;
+  unsigned ID = Arg->getOption().getID();
+  if (ID == OPT_discard_all)
+    return DiscardPolicy::All;
+  if (ID == OPT_discard_locals)
+    return DiscardPolicy::Locals;
+  return DiscardPolicy::None;
+}
----------------
ruiu wrote:
> Use switch-case.
Done.


https://reviews.llvm.org/D23868





More information about the llvm-commits mailing list