[PATCH] D54193: [llvm-strip] Check "strip" with StringRef::contains instead of ends_with

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 6 17:52:59 PST 2018


MaskRay created this revision.
MaskRay added reviewers: rupprecht, jhenderson, alexshap.
Herald added subscribers: llvm-commits, jakehehrlich.

If argv[0] is version suffixed, e.g. llvm-strip-7, this will still work.


Repository:
  rL LLVM

https://reviews.llvm.org/D54193

Files:
  tools/llvm-objcopy/llvm-objcopy.cpp


Index: tools/llvm-objcopy/llvm-objcopy.cpp
===================================================================
--- tools/llvm-objcopy/llvm-objcopy.cpp
+++ tools/llvm-objcopy/llvm-objcopy.cpp
@@ -219,7 +219,7 @@
   InitLLVM X(argc, argv);
   ToolName = argv[0];
   DriverConfig DriverConfig;
-  if (sys::path::stem(ToolName).endswith_lower("strip"))
+  if (sys::path::stem(ToolName).contains("strip"))
     DriverConfig = parseStripOptions(makeArrayRef(argv + 1, argc));
   else
     DriverConfig = parseObjcopyOptions(makeArrayRef(argv + 1, argc));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54193.172884.patch
Type: text/x-patch
Size: 549 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181107/5a0cdc8a/attachment.bin>


More information about the llvm-commits mailing list