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

Method OutputAsExpr

src/StatementAssign.cpp:511–596  ·  view source on GitHub ↗

* */

Source from the content-addressed store, hash-verified

509 *
510 */
511void
512StatementAssign::OutputAsExpr(std::ostream &out) const
513{
514 if (CGOptions::avoid_signed_overflow() && op_flags) {
515 switch (op) {
516
517 case eSimpleAssign:
518 case eBitAndAssign:
519 case eBitXorAssign:
520 case eBitOrAssign:
521 {
522 eBinaryOps bop = compound_to_binary_ops(op);
523 lhs.Output(out);
524 out << " ";
525 if (CGOptions::ccomp() && (bop != MAX_BINARY_OP) && (lhs.is_volatile())) {
526 out << "=" << " ";
527 lhs.Output(out);
528 out << " " << FunctionInvocationBinary::get_binop_string(bop) << " ";
529 expr.Output(out);
530 }
531 else {
532 output_op(out);
533 out << " ";
534 expr.Output(out);
535 }
536 break;
537 }
538
539 case ePreIncr:
540 out << "++"; lhs.Output(out);
541 break;
542 case ePreDecr:
543 out << "--"; lhs.Output(out);
544 break;
545 case ePostIncr:
546 lhs.Output(out); out << "++";
547 break;
548 case ePostDecr: lhs.Output(out);
549 out << "--";
550 break;
551
552 case eAddAssign:
553 case eSubAssign:
554 {
555 enum eBinaryOps bop = compound_to_binary_ops(op);
556 assert(op_flags);
557 string fname = op_flags->to_string(bop);
558 int id = SafeOpFlags::to_id(fname);
559 // don't use safe math wrapper if this function is specified in "--safe-math-wrapper"
560 if (!CGOptions::safe_math_wrapper(id)) {
561 OutputSimple(out);
562 return;
563 }
564 lhs.Output(out);
565 out << " = " << fname << "(";
566 if (CGOptions::math_notmp()) {
567 out << tmp_var1 << ", ";
568 }

Callers 2

OutputMethod · 0.80
output_headerMethod · 0.80

Calls 3

OutputMethod · 0.45
is_volatileMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected