[lld] r338600 - Revert r338596: Simplify. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 1 10:50:09 PDT 2018


Author: ruiu
Date: Wed Aug  1 10:50:09 2018
New Revision: 338600

URL: http://llvm.org/viewvc/llvm-project?rev=338600&view=rev
Log:
Revert r338596: Simplify. NFC.

This reverts commit r338596 because it contained a functional change.
The patch accidentally replaced StringRef::startswith with the exact match.

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=338600&r1=338599&r2=338600&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Wed Aug  1 10:50:09 2018
@@ -497,11 +497,14 @@ static Target2Policy getTarget2(opt::Inp
 }
 
 static bool isOutputFormatBinary(opt::InputArgList &Args) {
-  StringRef S = Args.getLastArgValue(OPT_oformat, "elf");
-  if (S == "binary")
-    return true;
-  if (S != "elf")
+  if (auto *Arg = Args.getLastArg(OPT_oformat)) {
+    StringRef S = Arg->getValue();
+    if (S == "binary")
+      return true;
+    if (S.startswith("elf"))
+      return false;
     error("unknown --oformat value: " + S);
+  }
   return false;
 }
 




More information about the llvm-commits mailing list