MCPcopy Create free account
hub / github.com/csmith-project/csmith / Output

Method Output

src/StatementArrayOp.cpp:245–290  ·  view source on GitHub ↗

* */

Source from the content-addressed store, hash-verified

243 *
244 */
245void
246StatementArrayOp::Output(std::ostream &out, FactMgr* fm, int indent) const
247{
248 size_t i;
249 output_header(out, indent);
250
251 if (body) {
252 body->Output(out, fm, indent);
253 }
254 else if (init_value) {
255 output_tab(out, indent);
256 out << "{";
257 outputln(out);
258 // cannot assign array members to a struct/union constant directly, has to create a "fake" struct var first
259 if (init_value->term_type == eConstant && array_var->is_aggregate()) {
260 output_tab(out, indent+1);
261 array_var->type->Output(out);
262 out << " tmp = ";
263 init_value->Output(out);
264 out << ";";
265 outputln(out);
266 output_tab(out, indent+1);
267 array_var->output_with_indices(out, ctrl_vars);
268 out << " = tmp;";
269 outputln(out);
270 }
271 else {
272 output_tab(out, indent+1);
273 array_var->output_with_indices(out, ctrl_vars);
274 out << " = ";
275 init_value->Output(out);
276 out << ";";
277 outputln(out);
278 }
279 output_tab(out, indent);
280 out << "}";
281 outputln(out);
282 }
283 // output the closing bracelets
284 for (i=1; i<array_var->get_dimension(); i++) {
285 indent--;
286 output_tab(out, indent);
287 out << "}";
288 outputln(out);
289 }
290}
291
292bool
293StatementArrayOp::visit_facts(vector<const Fact*>& inputs, CGContext& cg_context) const

Callers 1

output_headerMethod · 0.45

Calls 5

output_tabFunction · 0.85
outputlnFunction · 0.85
output_with_indicesMethod · 0.80
is_aggregateMethod · 0.45
get_dimensionMethod · 0.45

Tested by

no test coverage detected