aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Fuzzer/FuzzerUtil.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-05-23 01:22:35 +0000
committerKostya Serebryany <kcc@google.com>2015-05-23 01:22:35 +0000
commit7c180eafc12c19342c6606cca88fdcb6967aefac (patch)
treeb339c475a6e8ea116b9c8ae19cdddd6d2e19c293 /llvm/lib/Fuzzer/FuzzerUtil.cpp
parentddf76aa36fdd48e4c8bad9cb069cc5588e0ed149 (diff)
downloadllvm-7c180eafc12c19342c6606cca88fdcb6967aefac.zip
llvm-7c180eafc12c19342c6606cca88fdcb6967aefac.tar.gz
llvm-7c180eafc12c19342c6606cca88fdcb6967aefac.tar.bz2
[lib/Fuzzer] fully get rid of std::cerr in libFuzzer
llvm-svn: 238081
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerUtil.cpp')
-rw-r--r--llvm/lib/Fuzzer/FuzzerUtil.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerUtil.cpp b/llvm/lib/Fuzzer/FuzzerUtil.cpp
index 0685208..e381c04 100644
--- a/llvm/lib/Fuzzer/FuzzerUtil.cpp
+++ b/llvm/lib/Fuzzer/FuzzerUtil.cpp
@@ -12,7 +12,6 @@
#include "FuzzerInternal.h"
#include <sstream>
#include <iomanip>
-#include <iostream>
#include <sys/time.h>
#include <cassert>
#include <cstring>
@@ -23,18 +22,18 @@ namespace fuzzer {
void Print(const Unit &v, const char *PrintAfter) {
for (auto x : v)
- std::cerr << "0x" << std::hex << (unsigned) x << std::dec << ",";
- std::cerr << PrintAfter;
+ Printf("0x%x,", (unsigned) x);
+ Printf("%s", PrintAfter);
}
void PrintASCII(const Unit &U, const char *PrintAfter) {
for (auto X : U) {
if (isprint(X))
- std::cerr << X;
+ Printf("%c", X);
else
- std::cerr << "\\x" << std::hex << (int)(unsigned)X << std::dec;
+ Printf("\\x%x", (unsigned)X);
}
- std::cerr << PrintAfter;
+ Printf("%s", PrintAfter);
}
std::string Hash(const Unit &U) {
@@ -52,7 +51,7 @@ static void AlarmHandler(int, siginfo_t *, void *) {
void SetTimer(int Seconds) {
struct itimerval T {{Seconds, 0}, {Seconds, 0}};
- std::cerr << "SetTimer " << Seconds << "\n";
+ Printf("SetTimer %d\n", Seconds);
int Res = setitimer(ITIMER_REAL, &T, nullptr);
assert(Res == 0);
struct sigaction sigact;