[libFuzzer] replace string_view with string to fix the bots. This is NFC, just slower.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/fuzzer@360717 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/FuzzerDataFlowTrace.cpp b/FuzzerDataFlowTrace.cpp
index 9f15cb8..975a98a 100644
--- a/FuzzerDataFlowTrace.cpp
+++ b/FuzzerDataFlowTrace.cpp
@@ -22,7 +22,6 @@
#include <queue>
#include <sstream>
#include <string>
-#include <string_view>
#include <unordered_map>
#include <unordered_set>
#include <vector>
@@ -107,14 +106,14 @@
}
static void DFTStringAppendToVector(Vector<uint8_t> *DFT,
- const std::string_view DFTString) {
+ const std::string &DFTString) {
assert(DFT->size() == DFTString.size());
for (size_t I = 0, Len = DFT->size(); I < Len; I++)
(*DFT)[I] = DFTString[I] == '1';
}
// converts a string of '0' and '1' into a Vector<uint8_t>
-static Vector<uint8_t> DFTStringToVector(const std::string_view DFTString) {
+static Vector<uint8_t> DFTStringToVector(const std::string &DFTString) {
Vector<uint8_t> DFT(DFTString.size());
DFTStringAppendToVector(&DFT, DFTString);
return DFT;
@@ -131,8 +130,10 @@
return false;
};
+// TODO(metzman): replace std::string with std::string_view for
+// better performance. Need to figure our how to use string_view on Windows.
static bool ParseDFTLine(const std::string &Line, size_t *FunctionNum,
- std::string_view *DFTString) {
+ std::string *DFTString) {
if (!Line.empty() && Line[0] != 'F')
return false; // Ignore coverage.
size_t SpacePos = Line.find(' ');
@@ -213,7 +214,7 @@
std::ifstream IF(SF.File);
while (std::getline(IF, L, '\n')) {
size_t FunctionNum = 0;
- std::string_view DFTString;
+ std::string DFTString;
if (ParseDFTLine(L, &FunctionNum, &DFTString) &&
FunctionNum == FocusFuncIdx) {
NumTracesWithFocusFunction++;
@@ -282,7 +283,7 @@
Cov.insert(L);
} else if (L[0] == 'F') {
size_t FunctionNum = 0;
- std::string_view DFTString;
+ std::string DFTString;
if (ParseDFTLine(L, &FunctionNum, &DFTString)) {
auto &DFT = DFTMap[FunctionNum];
if (DFT.empty()) {