[llvm] [llvm-strings] Use small buffer instead of reading whole file (PR #163073)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 26 01:31:49 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;
----------------
jh7370 wrote:
Do we have a test case that covers not running off the end of this buffer, i.e. the file ending in a sequence of printable characters?
https://github.com/llvm/llvm-project/pull/163073
More information about the llvm-commits
mailing list