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

Method Output

src/FunctionInvocationBinary.cpp:321–392  ·  view source on GitHub ↗

* */

Source from the content-addressed store, hash-verified

319 *
320 */
321void
322FunctionInvocationBinary::Output(std::ostream &out) const
323{
324 bool need_cast = false;
325 out << "(";
326 // special case for mutated array subscripts, see ArrayVariable::rnd_mutate
327 // the rational is we don't need overflow check for this addition because
328 // the induction variable is small --- less than the size of array, which
329 // has a small upper bound
330 if (eFunc == eAdd && op_flags == 0) {
331 param_value[0]->Output(out);
332 out << " + ";
333 param_value[1]->Output(out);
334 }
335 else {
336 switch (eFunc) {
337 case eAdd:
338 case eSub:
339 case eMul:
340 case eMod:
341 case eDiv:
342 case eLShift:
343 case eRShift:
344 if (CGOptions::avoid_signed_overflow()) {
345 string fname = op_flags->to_string(eFunc);
346 int id = SafeOpFlags::to_id(fname);
347 // don't use safe math wrapper if this function is specified in "--safe-math-wrapper"
348 if (CGOptions::safe_math_wrapper(id)) {
349 out << fname << "(";
350 if (CGOptions::math_notmp()) {
351 out << tmp_var1 << ", ";
352 }
353 param_value[0]->Output(out);
354 out << ", ";
355
356 if (CGOptions::math_notmp()) {
357 out << tmp_var2 << ", ";
358 }
359 param_value[1]->Output(out);
360 if (CGOptions::identify_wrappers()) {
361 out << ", " << id;
362 }
363 out << ")";
364 break;
365 }
366 }
367 need_cast = true;
368 // fallthrough!
369
370 default:
371 // explicit type casting for op1
372 if (need_cast) {
373 out << "(";
374 op_flags->OutputSize(out);
375 out << ")";
376 }
377 param_value[0]->Output(out);
378 out << " ";

Callers

nothing calls this directly

Calls 3

OutputSizeMethod · 0.80
OutputStandardFuncNameFunction · 0.70
to_stringMethod · 0.45

Tested by

no test coverage detected