[libFuzzer] a bit of refactoring of the fork mode
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/fuzzer@353910 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/FuzzerIO.cpp b/FuzzerIO.cpp
index 91e1d20..33d6568 100644
--- a/FuzzerIO.cpp
+++ b/FuzzerIO.cpp
@@ -135,11 +135,11 @@
fflush(OutputFile);
}
-void RmFilesInDir(const std::string &Path) {
- Vector<std::string> Files;
- ListFilesInDirRecursive(Path, 0, &Files, /*TopDir*/true);
- for (auto &F : Files)
- RemoveFile(F);
+void RmDirRecursive(const std::string &Dir) {
+ IterateDirRecurisve(
+ Dir, [](const std::string &Path) {},
+ [](const std::string &Path) { RmDir(Path); },
+ [](const std::string &Path) { RemoveFile(Path); });
}
std::string TempPath(const char *Extension) {