[lld] r286406 - Simplify parseEmulation. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 9 14:32:43 PST 2016


Author: ruiu
Date: Wed Nov  9 16:32:43 2016
New Revision: 286406

URL: http://llvm.org/viewvc/llvm-project?rev=286406&view=rev
Log:
Simplify parseEmulation. NFC.

Modified:
    lld/trunk/ELF/Driver.cpp

Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=286406&r1=286405&r2=286406&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Wed Nov  9 16:32:43 2016
@@ -59,8 +59,7 @@ bool elf::link(ArrayRef<const char *> Ar
 }
 
 // Parses a linker -m option.
-static std::tuple<ELFKind, uint16_t, uint8_t, bool>
-parseEmulation(StringRef Emul) {
+static std::tuple<ELFKind, uint16_t, uint8_t> parseEmulation(StringRef Emul) {
   uint8_t OSABI = 0;
   StringRef S = Emul;
   if (S.endswith("_fbsd")) {
@@ -92,8 +91,7 @@ parseEmulation(StringRef Emul) {
     else
       error("unknown emulation: " + Emul);
   }
-  bool IsMipsN32ABI = S == "elf32btsmipn32" || S == "elf32ltsmipn32";
-  return std::make_tuple(Ret.first, Ret.second, OSABI, IsMipsN32ABI);
+  return std::make_tuple(Ret.first, Ret.second, OSABI);
 }
 
 // Returns slices of MB by parsing MB as an archive file.
@@ -463,8 +461,9 @@ void LinkerDriver::readConfigs(opt::Inpu
   if (auto *Arg = Args.getLastArg(OPT_m)) {
     // Parse ELF{32,64}{LE,BE} and CPU type.
     StringRef S = Arg->getValue();
-    std::tie(Config->EKind, Config->EMachine, Config->OSABI,
-             Config->MipsN32Abi) = parseEmulation(S);
+    std::tie(Config->EKind, Config->EMachine, Config->OSABI) =
+        parseEmulation(S);
+    Config->MipsN32Abi = (S == "elf32btsmipn32" || S == "elf32ltsmipn32");
     Config->Emulation = S;
   }
 




More information about the llvm-commits mailing list