summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/FuzzerUtil.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2016-05-26 20:03:02 +0000
committerKostya Serebryany <kcc@google.com>2016-05-26 20:03:02 +0000
commitf1f3f93c9efe6a409bc79d17cd8be1f860a758b4 (patch)
treef5eae3a76f6a660a59c9efb65099478230a9752d /llvm/lib/Fuzzer/FuzzerUtil.cpp
parent4a59a34597f49665faf351d6ee65515aa5fb86da (diff)
downloadbcm5719-llvm-f1f3f93c9efe6a409bc79d17cd8be1f860a758b4.tar.gz
bcm5719-llvm-f1f3f93c9efe6a409bc79d17cd8be1f860a758b4.zip
[libFuzzer] reimplement the way we do -only_ascii to allow more 'const' in function declarations. Add a test for -only_ascii. NFC intended
llvm-svn: 270900
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerUtil.cpp')
-rw-r--r--llvm/lib/Fuzzer/FuzzerUtil.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerUtil.cpp b/llvm/lib/Fuzzer/FuzzerUtil.cpp
index ec592e03f23..420f05d05c4 100644
--- a/llvm/lib/Fuzzer/FuzzerUtil.cpp
+++ b/llvm/lib/Fuzzer/FuzzerUtil.cpp
@@ -164,9 +164,11 @@ bool ToASCII(uint8_t *Data, size_t Size) {
return Changed;
}
-bool IsASCII(const Unit &U) {
- for (auto X : U)
- if (!(isprint(X) || isspace(X))) return false;
+bool IsASCII(const Unit &U) { return IsASCII(U.data(), U.size()); }
+
+bool IsASCII(const uint8_t *Data, size_t Size) {
+ for (size_t i = 0; i < Size; i++)
+ if (!(isprint(Data[i]) || isspace(Data[i]))) return false;
return true;
}
OpenPOWER on IntegriCloud