@@ -81,7 +81,7 @@ void SimpleTreeEncoder::appendDef(const Defect &def)
81
81
evtNode.put <int >(" verbosity_level" , evt.verbosityLevel );
82
82
83
83
// append the event to the list
84
- evtList. push_back ( std::make_pair ( " " , evtNode) );
84
+ appendNode (&evtList , evtNode);
85
85
}
86
86
87
87
// create a node for a single defect
@@ -110,7 +110,7 @@ void SimpleTreeEncoder::appendDef(const Defect &def)
110
110
pDefects_ = &root_.put_child (" defects" , PTree ());
111
111
112
112
// append the node to the list
113
- pDefects_-> push_back ( std::make_pair ( " " , defNode) );
113
+ appendNode (pDefects_ , defNode);
114
114
}
115
115
116
116
void SimpleTreeEncoder::writeTo (std::ostream &str)
@@ -213,11 +213,11 @@ static void sarifEncodeEvt(PTree *pDst, const Defect &def, unsigned idx)
213
213
PTree kind;
214
214
kind.put <std::string>(" " , evt.event );
215
215
PTree kindList;
216
- kindList. put_child ( " " , kind);
216
+ appendNode (&kindList , kind);
217
217
tfLoc.put_child (" kinds" , kindList);
218
218
219
219
// append the threadFlowLocation object to the destination array
220
- pDst-> push_back ( std::make_pair ( " " , tfLoc) );
220
+ appendNode (pDst , tfLoc);
221
221
}
222
222
223
223
void SarifTreeEncoder::appendDef (const Defect &def)
@@ -233,7 +233,7 @@ void SarifTreeEncoder::appendDef(const Defect &def)
233
233
PTree loc;
234
234
sarifEncodeLoc (&loc, def, def.keyEventIdx );
235
235
PTree keyLocs;
236
- keyLocs. put_child ( " " , loc);
236
+ appendNode (&keyLocs , loc);
237
237
result.put_child (" locations" , keyLocs);
238
238
239
239
// key msg
@@ -250,17 +250,17 @@ void SarifTreeEncoder::appendDef(const Defect &def)
250
250
251
251
// threadFlows
252
252
PTree tfList;
253
- tfList. put_child ( " " , tf);
253
+ appendNode (&tfList , tf);
254
254
PTree cf;
255
255
cf.put_child (" threadFlows" , tfList);
256
256
257
257
// codeFlows
258
258
PTree cfList;
259
- cfList. put_child ( " " , cf);
259
+ appendNode (&cfList , cf);
260
260
result.put_child (" codeFlows" , cfList);
261
261
262
262
// append the `result` object to the `results` array
263
- results_. push_back ( std::make_pair ( " " , result) );
263
+ appendNode (&results_ , result);
264
264
}
265
265
266
266
void SarifTreeEncoder::writeTo (std::ostream &str)
@@ -281,7 +281,7 @@ void SarifTreeEncoder::writeTo(std::ostream &str)
281
281
PTree extProps;
282
282
extProps.put_child (" externalizedProperties" , props);
283
283
PTree propsList;
284
- propsList. put_child ( " " , extProps);
284
+ appendNode (&propsList , extProps);
285
285
root.put_child (" inlineExternalProperties" , propsList);
286
286
}
287
287
@@ -291,7 +291,7 @@ void SarifTreeEncoder::writeTo(std::ostream &str)
291
291
292
292
// mandatory: runs
293
293
PTree runs;
294
- runs. put_child ( " " , run0_);
294
+ appendNode (&runs , run0_);
295
295
root.put_child (" runs" , runs);
296
296
297
297
// encode as JSON
0 commit comments