[lld][MachO] Code cleanup
authorAlexander Shaposhnikov <alexshap@fb.com>
Wed, 14 Jul 2021 11:33:09 +0000 (04:33 -0700)
committerAlexander Shaposhnikov <alexshap@fb.com>
Wed, 14 Jul 2021 11:33:09 +0000 (04:33 -0700)
Make use of ArgList::getLastArgValue. NFC.

Test plan: make check-lld-macho

Differential revision: https://reviews.llvm.org/D105452

lld/MachO/Driver.cpp

index e146991..fa84c3f 100644 (file)
@@ -1142,10 +1142,8 @@ bool macho::link(ArrayRef<const char *> argsArr, bool canExitEarly,
 
   config->mapFile = args.getLastArgValue(OPT_map);
   config->outputFile = args.getLastArgValue(OPT_o, "a.out");
-  if (const Arg *arg = args.getLastArg(OPT_final_output))
-    config->finalOutput = arg->getValue();
-  else
-    config->finalOutput = config->outputFile;
+  config->finalOutput =
+      args.getLastArgValue(OPT_final_output, config->outputFile);
   config->astPaths = args.getAllArgValues(OPT_add_ast_path);
   config->headerPad = args::getHex(args, OPT_headerpad, /*Default=*/32);
   config->headerPadMaxInstallNames =