[llvm] r286914 - llvm-strings: support the `-n` option
Meador Inge via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 14 18:16:34 PST 2016
On Tue, Nov 15, 2016 at 12:43:52AM +0000, Saleem Abdulrasool via llvm-commits wrote:
> Added: llvm/trunk/test/tools/llvm-strings/length.test
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-strings/length.test?rev=286914&view=auto
> ==============================================================================
> --- llvm/trunk/test/tools/llvm-strings/length.test (added)
> +++ llvm/trunk/test/tools/llvm-strings/length.test Mon Nov 14 18:43:52 2016
> @@ -0,0 +1,24 @@
> +RUN: sed -n 's/^STDIN: //p' %s | llvm-strings | FileCheck --check-prefix CHECK-DEFAULT %s
> +RUN: sed -n 's/^STDIN: //p' %s | not llvm-strings -n 0 2>&1 | FileCheck --check-prefix CHECK-0 %s
> +RUN: sed -n 's/^STDIN: //p' %s | llvm-strings -n 1 | FileCheck --check-prefix CHECK-1 %s
> +RUN: sed -n 's/^STDIN: //p' %s | llvm-strings -n 2 | FileCheck --check-prefix CHECK-2 %s
Another option is `echo -e 'a\nbc\ndef\nghij'`.
> Modified: llvm/trunk/tools/llvm-strings/llvm-strings.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-strings/llvm-strings.cpp?rev=286914&r1=286913&r2=286914&view=diff
> ==============================================================================
> --- llvm/trunk/tools/llvm-strings/llvm-strings.cpp (original)
> +++ llvm/trunk/tools/llvm-strings/llvm-strings.cpp Mon Nov 14 18:43:52 2016
> @@ -35,8 +35,15 @@ static cl::opt<bool>
> static cl::alias PrintFileNameShort("f", cl::desc(""),
> cl::aliasopt(PrintFileName));
>
> +static cl::opt<int>
> + MinLength("bytes", cl::desc("Print sequences of the specified length"),
> + cl::init(4));
Isn't this really to print sequences of *at least* the specified length?
--
Meador Inge
meadori at codesourcery.com
CodeSourcery / Mentor Embedded
More information about the llvm-commits
mailing list