[PATCH] D67782: [ELF] accept thinlto options without --plugin-opt= prefix

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 24 05:31:34 PDT 2019


ruiu added inline comments.


================
Comment at: lld/ELF/Driver.cpp:760
 
+static StringRef aliasSpelling(llvm::opt::Arg *arg) {
+  const llvm::opt::Arg *alias = arg->getAlias();
----------------
Maybe getAliasSpelling is better?


================
Comment at: lld/ELF/Driver.cpp:764
+    return alias->getSpelling();
+  else
+    return arg->getSpelling();
----------------
nit: no `else` after `return`

You can combine the definition and the `if` statement as this:

  if (const llvm::opt::Arg *alias = arg->getAlias())
    ...


================
Comment at: lld/ELF/Options.td:525-550
+def plugin_opt_obj_path_eq: J<"plugin-opt=obj-path=">,
+    Alias<lto_obj_path_eq>,
+    HelpText<"Alias for -lto-obj-path=">;
 def: J<"plugin-opt=sample-profile=">,
   Alias<lto_sample_profile>, HelpText<"Alias for -lto-sample-profile">;
 def: F<"plugin-opt=save-temps">, Alias<save_temps>, HelpText<"Alias for -save-temps">;
+def plugin_opt_thinlto_emit_imports_files:
----------------
These alias flags are not accessed from the code by name, so you can omit names like this:

  def: J<"plugin-opt=thinlto-prefix-replace=">,
    Alias<...

which makes it clear that they are really aliases.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67782/new/

https://reviews.llvm.org/D67782





More information about the llvm-commits mailing list