summaryrefslogtreecommitdiff
path: root/lib/fuzzer/FuzzerIO.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2017-09-12 21:58:07 +0000
committerKostya Serebryany <kcc@google.com>2017-09-12 21:58:07 +0000
commitfd50a2ebe13b5ae0f7f77d9f5955eebf5f9f6811 (patch)
tree3013a5cbc106e85791f38b8a6e0429ff50c5d537 /lib/fuzzer/FuzzerIO.cpp
parent45735bcdc31ea2cb1e56eea5dd84189139c78eef (diff)
downloadcompiler-rt-fd50a2ebe13b5ae0f7f77d9f5955eebf5f9f6811.tar.gz
[libFuzzer] factor out some code into GetSizedFilesFromDir; NFC
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313081 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/fuzzer/FuzzerIO.cpp')
-rw-r--r--lib/fuzzer/FuzzerIO.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/fuzzer/FuzzerIO.cpp b/lib/fuzzer/FuzzerIO.cpp
index b3adfacf3..dac5ec658 100644
--- a/lib/fuzzer/FuzzerIO.cpp
+++ b/lib/fuzzer/FuzzerIO.cpp
@@ -86,6 +86,15 @@ void ReadDirToVectorOfUnits(const char *Path, Vector<Unit> *V,
}
}
+
+void GetSizedFilesFromDir(const std::string &Dir, Vector<SizedFile> *V) {
+ Vector<std::string> Files;
+ ListFilesInDirRecursive(Dir, 0, &Files, /*TopDir*/true);
+ for (auto &File : Files)
+ if (size_t Size = FileSize(File))
+ V->push_back({File, Size});
+}
+
std::string DirPlusFile(const std::string &DirPath,
const std::string &FileName) {
return DirPath + GetSeparator() + FileName;