aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Fuzzer/FuzzerIO.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-03-31 20:13:20 +0000
committerKostya Serebryany <kcc@google.com>2015-03-31 20:13:20 +0000
commit52a788e5037d9cd8af981a1b64af9d76b7b6b798 (patch)
treef5bcb681f3ce80ae15052121401bde1272ffe913 /llvm/lib/Fuzzer/FuzzerIO.cpp
parentd2edb241e2397bb623e5e86a33d31d1cca7c342e (diff)
downloadllvm-52a788e5037d9cd8af981a1b64af9d76b7b6b798.zip
llvm-52a788e5037d9cd8af981a1b64af9d76b7b6b798.tar.gz
llvm-52a788e5037d9cd8af981a1b64af9d76b7b6b798.tar.bz2
[fuzzer] Add support for token-based fuzzing (e.g. for C++). Allow string flags.
llvm-svn: 233745
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerIO.cpp')
-rw-r--r--llvm/lib/Fuzzer/FuzzerIO.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerIO.cpp b/llvm/lib/Fuzzer/FuzzerIO.cpp
index 224808c..ef23d42e 100644
--- a/llvm/lib/Fuzzer/FuzzerIO.cpp
+++ b/llvm/lib/Fuzzer/FuzzerIO.cpp
@@ -33,6 +33,12 @@ Unit FileToVector(const std::string &Path) {
std::istreambuf_iterator<char>());
}
+std::string FileToString(const std::string &Path) {
+ std::ifstream T(Path);
+ return std::string((std::istreambuf_iterator<char>(T)),
+ std::istreambuf_iterator<char>());
+}
+
void CopyFileToErr(const std::string &Path) {
std::ifstream T(Path);
std::copy(std::istreambuf_iterator<char>(T), std::istreambuf_iterator<char>(),