summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/FuzzerIOPosix.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2016-11-30 21:53:32 +0000
committerKostya Serebryany <kcc@google.com>2016-11-30 21:53:32 +0000
commit1cba0a96e7def030a89bd1bf10c355e515b0957b (patch)
tree38fb4bd954f2db20c97d0484c8a9939c7052eccb /llvm/lib/Fuzzer/FuzzerIOPosix.cpp
parent5abac1769f36e4f7d9d6c3a408a1356490fc76e0 (diff)
downloadbcm5719-llvm-1cba0a96e7def030a89bd1bf10c355e515b0957b.tar.gz
bcm5719-llvm-1cba0a96e7def030a89bd1bf10c355e515b0957b.zip
[libFuzzer] extend -print_coverage to print the comma-separated list of covered dirs. Note: the Windows stub for DirName is left unimplemented
llvm-svn: 288276
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerIOPosix.cpp')
-rw-r--r--llvm/lib/Fuzzer/FuzzerIOPosix.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerIOPosix.cpp b/llvm/lib/Fuzzer/FuzzerIOPosix.cpp
index 740d52d0b1d..a4290face97 100644
--- a/llvm/lib/Fuzzer/FuzzerIOPosix.cpp
+++ b/llvm/lib/Fuzzer/FuzzerIOPosix.cpp
@@ -18,8 +18,9 @@
#include <dirent.h>
#include <fstream>
#include <iterator>
-#include <sys/types.h>
+#include <libgen.h>
#include <sys/stat.h>
+#include <sys/types.h>
#include <unistd.h>
namespace fuzzer {
@@ -74,5 +75,13 @@ void DeleteFile(const std::string &Path) {
unlink(Path.c_str());
}
+std::string DirName(const std::string &FileName) {
+ char *Tmp = new char[FileName.size() + 1];
+ memcpy(Tmp, FileName.c_str(), FileName.size() + 1);
+ std::string Res = dirname(Tmp);
+ delete [] Tmp;
+ return Res;
+}
+
} // namespace fuzzer
#endif // LIBFUZZER_POSIX
OpenPOWER on IntegriCloud