[PATCH] D40020: [llvm-strings] Add support for the -a/--all options

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 04:02:41 PST 2017


mstorsjo created this revision.

They don't actually change nay behaviour, as llvm-strings currently checks the whole object without looking at individual sections anyway.

This allows using llvm-strings in a context that explicitly passes the -a option.


https://reviews.llvm.org/D40020

Files:
  test/tools/llvm-strings/all-sections.test
  tools/llvm-strings/llvm-strings.cpp


Index: tools/llvm-strings/llvm-strings.cpp
===================================================================
--- tools/llvm-strings/llvm-strings.cpp
+++ tools/llvm-strings/llvm-strings.cpp
@@ -41,6 +41,12 @@
               cl::init(4));
 static cl::alias MinLengthShort("n", cl::desc(""), cl::aliasopt(MinLength));
 
+static cl::opt<bool>
+    AllSections("all",
+                  cl::desc("Check all sections, not just the data section"));
+static cl::alias AllSectionsShort("a", cl::desc(""),
+                                    cl::aliasopt(AllSections));
+
 enum radix { none, octal, hexadecimal, decimal };
 static cl::opt<radix>
     Radix("radix", cl::desc("print the offset within the file"),
Index: test/tools/llvm-strings/all-sections.test
===================================================================
--- /dev/null
+++ test/tools/llvm-strings/all-sections.test
@@ -0,0 +1,3 @@
+RUN: llvm-strings -a %S/Inputs/abcd | FileCheck %s
+RUN: llvm-strings --all %S/Inputs/abcd | FileCheck %s
+CHECK: abcd


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40020.122819.patch
Type: text/x-patch
Size: 1018 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171114/292ca7e6/attachment.bin>


More information about the llvm-commits mailing list