[llvm] [llvm-strings] Use small buffer instead of reading whole file (PR #163073)

via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 18:59:31 PDT 2026


================
@@ -129,40 +137,65 @@ static void strings(raw_ostream &OS, StringRef FileName,
              << errorToErrorCode(ReadBytesOrErr.takeError()).message() << '\n';
       return;
     }
-    std::size_t CurSize = *ReadBytesOrErr;
-    if (CurSize == 0)
+    std::size_t ChunkSize = *ReadBytesOrErr;
+    if (ChunkSize == 0)
       break;
 
-    std::size_t I = 0;
-    while (I != CurSize) {
+    const char *const B = Buffer.data();
+    const char *const E = B + ChunkSize;
+    const char *P = B;
+
+    if (InString || !Candidate.empty()) {
+      while (P != E && isStringChar(*P))
+        ++P;
----------------
aokblast wrote:

Yes, the test under case 6 is for this.

https://github.com/llvm/llvm-project/pull/163073


More information about the llvm-commits mailing list