[lld] r301757 - Report an error if --compress-debug-sections is given while zlib is not availble.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 29 15:56:24 PDT 2017


Author: ruiu
Date: Sat Apr 29 17:56:24 2017
New Revision: 301757

URL: http://llvm.org/viewvc/llvm-project?rev=301757&view=rev
Log:
Report an error if --compress-debug-sections is given while zlib is not availble.

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=301757&r1=301756&r2=301757&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Sat Apr 29 17:56:24 2017
@@ -594,14 +594,14 @@ static std::vector<StringRef> getLines(M
 }
 
 static bool getCompressDebugSections(opt::InputArgList &Args) {
-  if (auto *Arg = Args.getLastArg(OPT_compress_debug_sections)) {
-    StringRef S = Arg->getValue();
-    if (S == "zlib")
-      return zlib::isAvailable();
-    if (S != "none")
-      error("unknown --compress-debug-sections value: " + S);
-  }
-  return false;
+  StringRef S = getString(Args, OPT_compress_debug_sections, "none");
+  if (S == "none")
+    return false;
+  if (S != "zlib")
+    error("unknown --compress-debug-sections value: " + S);
+  if (!zlib::isAvailable())
+    error("--compress-debug-sections: zlib is not available");
+  return true;
 }
 
 // Initializes Config members by the command line options.




More information about the llvm-commits mailing list