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

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 29 15:30:09 PDT 2016


ruiu 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 };
+
----------------
They need comments.

  // For --build-id.
  // For --unresolved-symbols.
  // For --discard-{all,locals}.

================
Comment at: ELF/Config.h:84
@@ -83,3 +84,1 @@
-  bool DiscardLocals;
-  bool DiscardNone;
   bool EhFrameHdr;
----------------
I couldn't find --discard-none in GNU ld manual. Where did this come from?

================
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;
+}
----------------
Use switch-case.


https://reviews.llvm.org/D23868





More information about the llvm-commits mailing list