@@ -37,7 +37,7 @@ bool BlockCoverage::AppendCoverage(const std::string &S) {
37
37
// Coverage lines have this form:
38
38
// CN X Y Z T
39
39
// where N is the number of the function, T is the total number of instrumented
40
- // BBs, and X,Y,Z, if present, are the indecies of covered BB.
40
+ // BBs, and X,Y,Z, if present, are the indices of covered BB.
41
41
// BB #0, which is the entry block, is not explicitly listed.
42
42
bool BlockCoverage::AppendCoverage (std::istream &IN) {
43
43
std::string L;
@@ -52,7 +52,7 @@ bool BlockCoverage::AppendCoverage(std::istream &IN) {
52
52
continue ;
53
53
}
54
54
if (L[0 ] != ' C' ) continue ;
55
- Vector <uint32_t > CoveredBlocks;
55
+ std::vector <uint32_t > CoveredBlocks;
56
56
while (true ) {
57
57
uint32_t BB = 0 ;
58
58
SS >> BB;
@@ -68,7 +68,7 @@ bool BlockCoverage::AppendCoverage(std::istream &IN) {
68
68
auto It = Functions.find (FunctionId);
69
69
auto &Counters =
70
70
It == Functions.end ()
71
- ? Functions.insert ({FunctionId, Vector <uint32_t >(NumBlocks)})
71
+ ? Functions.insert ({FunctionId, std::vector <uint32_t >(NumBlocks)})
72
72
.first ->second
73
73
: It->second ;
74
74
@@ -86,8 +86,8 @@ bool BlockCoverage::AppendCoverage(std::istream &IN) {
86
86
// * any uncovered function gets weight 0.
87
87
// * a function with lots of uncovered blocks gets bigger weight.
88
88
// * a function with a less frequently executed code gets bigger weight.
89
- Vector <double > BlockCoverage::FunctionWeights (size_t NumFunctions) const {
90
- Vector <double > Res (NumFunctions);
89
+ std::vector <double > BlockCoverage::FunctionWeights (size_t NumFunctions) const {
90
+ std::vector <double > Res (NumFunctions);
91
91
for (auto It : Functions) {
92
92
auto FunctionID = It.first ;
93
93
auto Counters = It.second ;
@@ -104,7 +104,7 @@ Vector<double> BlockCoverage::FunctionWeights(size_t NumFunctions) const {
104
104
}
105
105
106
106
void DataFlowTrace::ReadCoverage (const std::string &DirPath) {
107
- Vector <SizedFile> Files;
107
+ std::vector <SizedFile> Files;
108
108
GetSizedFilesFromDir (DirPath, &Files);
109
109
for (auto &SF : Files) {
110
110
auto Name = Basename (SF.File );
@@ -115,16 +115,16 @@ void DataFlowTrace::ReadCoverage(const std::string &DirPath) {
115
115
}
116
116
}
117
117
118
- static void DFTStringAppendToVector (Vector <uint8_t > *DFT,
118
+ static void DFTStringAppendToVector (std::vector <uint8_t > *DFT,
119
119
const std::string &DFTString) {
120
120
assert (DFT->size () == DFTString.size ());
121
121
for (size_t I = 0 , Len = DFT->size (); I < Len; I++)
122
122
(*DFT)[I] = DFTString[I] == ' 1' ;
123
123
}
124
124
125
- // converts a string of '0' and '1' into a Vector <uint8_t>
126
- static Vector <uint8_t > DFTStringToVector (const std::string &DFTString) {
127
- Vector <uint8_t > DFT (DFTString.size ());
125
+ // converts a string of '0' and '1' into a std::vector <uint8_t>
126
+ static std::vector <uint8_t > DFTStringToVector (const std::string &DFTString) {
127
+ std::vector <uint8_t > DFT (DFTString.size ());
128
128
DFTStringAppendToVector (&DFT, DFTString);
129
129
return DFT;
130
130
}
@@ -159,14 +159,14 @@ static bool ParseDFTLine(const std::string &Line, size_t *FunctionNum,
159
159
}
160
160
161
161
bool DataFlowTrace::Init (const std::string &DirPath, std::string *FocusFunction,
162
- Vector <SizedFile> &CorporaFiles, Random &Rand) {
162
+ std::vector <SizedFile> &CorporaFiles, Random &Rand) {
163
163
if (DirPath.empty ()) return false ;
164
164
Printf (" INFO: DataFlowTrace: reading from '%s'\n " , DirPath.c_str ());
165
- Vector <SizedFile> Files;
165
+ std::vector <SizedFile> Files;
166
166
GetSizedFilesFromDir (DirPath, &Files);
167
167
std::string L;
168
168
size_t FocusFuncIdx = SIZE_MAX;
169
- Vector <std::string> FunctionNames;
169
+ std::vector <std::string> FunctionNames;
170
170
171
171
// Collect the hashes of the corpus files.
172
172
for (auto &SF : CorporaFiles)
@@ -191,7 +191,7 @@ bool DataFlowTrace::Init(const std::string &DirPath, std::string *FocusFunction,
191
191
// * chooses a random function according to the weights.
192
192
ReadCoverage (DirPath);
193
193
auto Weights = Coverage.FunctionWeights (NumFunctions);
194
- Vector <double > Intervals (NumFunctions + 1 );
194
+ std::vector <double > Intervals (NumFunctions + 1 );
195
195
std::iota (Intervals.begin (), Intervals.end (), 0 );
196
196
auto Distribution = std::piecewise_constant_distribution<double >(
197
197
Intervals.begin (), Intervals.end (), Weights.begin ());
@@ -247,7 +247,7 @@ bool DataFlowTrace::Init(const std::string &DirPath, std::string *FocusFunction,
247
247
}
248
248
249
249
int CollectDataFlow (const std::string &DFTBinary, const std::string &DirPath,
250
- const Vector <SizedFile> &CorporaFiles) {
250
+ const std::vector <SizedFile> &CorporaFiles) {
251
251
Printf (" INFO: collecting data flow: bin: %s dir: %s files: %zd\n " ,
252
252
DFTBinary.c_str (), DirPath.c_str (), CorporaFiles.size ());
253
253
if (CorporaFiles.empty ()) {
@@ -265,7 +265,7 @@ int CollectDataFlow(const std::string &DFTBinary, const std::string &DirPath,
265
265
// we then request tags in [0,Size/2) and [Size/2, Size), and so on.
266
266
// Function number => DFT.
267
267
auto OutPath = DirPlusFile (DirPath, Hash (FileToVector (F.File )));
268
- std::unordered_map<size_t , Vector <uint8_t >> DFTMap;
268
+ std::unordered_map<size_t , std::vector <uint8_t >> DFTMap;
269
269
std::unordered_set<std::string> Cov;
270
270
Command Cmd;
271
271
Cmd.addArgument (DFTBinary);
0 commit comments