[PATCH] D23867: [ELF] - Fix (partial) for bug 28843 - Make sure we handle options with opposing meanings.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 30 07:40:24 PDT 2016


grimar added inline comments.

================
Comment at: ELF/Driver.cpp:347-357
@@ -346,1 +346,13 @@
 
+static bool shouldDemangle(opt::InputArgList &Args) {
+  if (auto *Arg = Args.getLastArg(OPT_demangle, OPT_no_demangle))
+    return Arg->getOption().getID() == OPT_demangle;
+  return true;
+}
+
+static bool shouldUseTarget1Rel(opt::InputArgList &Args) {
+  if (auto *Arg = Args.getLastArg(OPT_target1_abs, OPT_target1_rel))
+    return Arg->getOption().getID() == OPT_target1_rel;
+  return false;
+}
+
----------------
ruiu wrote:
> I can see the same pattern here. How about this?
> 
>   static bool getArg(opt::InputArgList &Args, unsigned K1, unsigned K2, bool Default) {
>     if (auto *Arg = Args.getLastArg(K1, K2))
>       return Arg->getOption().getID() == K1;
>     return Default;
>   }
I tried the same when wrote this. Finished with my version because find it slightly more readable (too much arguments imo).
No real preference here though. Lets go with your version if you prefer it.


https://reviews.llvm.org/D23867





More information about the llvm-commits mailing list