We would ignore the last string that appeared if the file ended with a printable
character. Ensure that we get the last string.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286706
91177308-0d34-0410-b5e6-
96231b3b80d8
--- /dev/null
+RUN: echo -n abc | llvm-strings - | FileCheck -allow-empty %s
+CHECK-NOT: abc
--- /dev/null
+RUN: echo -n abcdefg | llvm-strings - | FileCheck %s
+CHECK: abcdefg
cl::ZeroOrMore);
static void dump(raw_ostream &OS, StringRef Contents) {
- const char *S = nullptr;
- for (const char *P = Contents.begin(), *E = Contents.end(); P < E; ++P) {
+ const char *P = nullptr, *E = nullptr, *S = nullptr;
+ for (P = Contents.begin(), E = Contents.end(); P < E; ++P) {
if (std::isgraph(*P) || std::isblank(*P)) {
if (S == nullptr)
S = P;
S = nullptr;
}
}
+ if (S && E - S > 3)
+ OS << StringRef(S, E - S) << '\n';
}
namespace {