aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Fuzzer/FuzzerIO.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-01-28 23:48:39 +0000
committerKostya Serebryany <kcc@google.com>2015-01-28 23:48:39 +0000
commit265cf04f9c738f3be7a941d87eaee80d928be39e (patch)
treeb75dca4aea21f52a9af650086b596194f120dfab /llvm/lib/Fuzzer/FuzzerIO.cpp
parent1689d3f732a410dd6a09961f0e8a9fbe0d62c4ac (diff)
downloadllvm-265cf04f9c738f3be7a941d87eaee80d928be39e.zip
llvm-265cf04f9c738f3be7a941d87eaee80d928be39e.tar.gz
llvm-265cf04f9c738f3be7a941d87eaee80d928be39e.tar.bz2
[fuzzer] add option -save_minimized_corpus
llvm-svn: 227395
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerIO.cpp')
-rw-r--r--llvm/lib/Fuzzer/FuzzerIO.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerIO.cpp b/llvm/lib/Fuzzer/FuzzerIO.cpp
index 172540c..4e0ac81 100644
--- a/llvm/lib/Fuzzer/FuzzerIO.cpp
+++ b/llvm/lib/Fuzzer/FuzzerIO.cpp
@@ -13,7 +13,7 @@
#include <dirent.h>
namespace fuzzer {
-std::vector<std::string> ListFilesInDir(const std::string &Dir) {
+static std::vector<std::string> ListFilesInDir(const std::string &Dir) {
std::vector<std::string> V;
DIR *D = opendir(Dir.c_str());
if (!D) return V;
@@ -38,7 +38,12 @@ void WriteToFile(const Unit &U, const std::string &Path) {
void ReadDirToVectorOfUnits(const char *Path, std::vector<Unit> *V) {
for (auto &X : ListFilesInDir(Path))
- V->push_back(FileToVector(std::string(Path) + "/" + X));
+ V->push_back(FileToVector(DirPlusFile(Path, X)));
+}
+
+std::string DirPlusFile(const std::string &DirPath,
+ const std::string &FileName) {
+ return DirPath + "/" + FileName;
}
} // namespace fuzzer