summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/FuzzerUtil.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-04-01 21:33:20 +0000
committerKostya Serebryany <kcc@google.com>2015-04-01 21:33:20 +0000
commit043ab1c8a7c3e125319039ef504abb2127c23dbb (patch)
tree97f737d8940d9d0161a10e4d25160ac4946da5aa /llvm/lib/Fuzzer/FuzzerUtil.cpp
parent4950f111fab1c429dff7b740514edb9dfbd3625a (diff)
downloadbcm5719-llvm-043ab1c8a7c3e125319039ef504abb2127c23dbb.tar.gz
bcm5719-llvm-043ab1c8a7c3e125319039ef504abb2127c23dbb.zip
[fuzzer] document the -tokens flag. Also change the diagnostic output
llvm-svn: 233842
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerUtil.cpp')
-rw-r--r--llvm/lib/Fuzzer/FuzzerUtil.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerUtil.cpp b/llvm/lib/Fuzzer/FuzzerUtil.cpp
index 3f62a1f1d1e..3635f39a10d 100644
--- a/llvm/lib/Fuzzer/FuzzerUtil.cpp
+++ b/llvm/lib/Fuzzer/FuzzerUtil.cpp
@@ -19,15 +19,18 @@
namespace fuzzer {
void Print(const Unit &v, const char *PrintAfter) {
- std::cerr << v.size() << ": ";
for (auto x : v)
- std::cerr << (unsigned) x << " ";
+ std::cerr << "0x" << std::hex << (unsigned) x << std::dec << ",";
std::cerr << PrintAfter;
}
void PrintASCII(const Unit &U, const char *PrintAfter) {
- for (auto X : U)
- std::cerr << (char)((isascii(X) && X >= ' ') ? X : '?');
+ for (auto X : U) {
+ if (isprint(X))
+ std::cerr << X;
+ else
+ std::cerr << "\\x" << std::hex << (int)(unsigned)X << std::dec;
+ }
std::cerr << PrintAfter;
}
OpenPOWER on IntegriCloud