llvm-strings: ensure that the last string is correctly printed

We would ignore the last string that appeared if the file ended with a printable
character.  Ensure that we get the last string.

llvm-svn: 286706
diff --git a/llvm/tools/llvm-strings/llvm-strings.cpp b/llvm/tools/llvm-strings/llvm-strings.cpp
index d590b70..dbabf08 100644
--- a/llvm/tools/llvm-strings/llvm-strings.cpp
+++ b/llvm/tools/llvm-strings/llvm-strings.cpp
@@ -33,8 +33,8 @@
                                             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;
@@ -44,6 +44,8 @@
       S = nullptr;
     }
   }
+  if (S && E - S > 3)
+    OS << StringRef(S, E - S) << '\n';
 }
 
 namespace {