[PATCH] D48433: [ELF] - Report unimplemented -z options.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 26 22:51:45 PDT 2018


ruiu added a comment.

I wonder if this is the best way to do an error check. Did you try something like this?

  for (auto *Arg : Args.filtered(OPT_z)) {
    StringRef S = Arg->getValue();
    if (S != "mudefs" && S != "hazardplt" && S != "relro" && ...)
      error("unknown -z value:  " + S);
  }

This is simple-minded and less-abstracted, which is usually preferred in lld.



================
Comment at: ELF/Driver.cpp:310
 
+static void claimZOptions(opt::InputArgList &Args, ArrayRef<StringRef> Keys) {
+  for (auto *Arg : Args.filtered(OPT_z))
----------------
I'd make this function to take just one Key instead of arbitrary number of keys. I'd also rename this just `claim`.


https://reviews.llvm.org/D48433





More information about the llvm-commits mailing list