diff options
| author | Kostya Serebryany <kcc@google.com> | 2017-09-12 21:58:07 +0000 |
|---|---|---|
| committer | Kostya Serebryany <kcc@google.com> | 2017-09-12 21:58:07 +0000 |
| commit | fd50a2ebe13b5ae0f7f77d9f5955eebf5f9f6811 (patch) | |
| tree | 3013a5cbc106e85791f38b8a6e0429ff50c5d537 /lib/fuzzer/FuzzerIO.cpp | |
| parent | 45735bcdc31ea2cb1e56eea5dd84189139c78eef (diff) | |
| download | compiler-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.cpp | 9 |
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; |
