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

Method output_addr_checks

src/ArrayVariable.cpp:700–753  ·  view source on GitHub ↗

--------------------------------------------------------------

Source from the content-addressed store, hash-verified

698
699// --------------------------------------------------------------
700void
701ArrayVariable::output_addr_checks(std::ostream &out, const Variable* var, string field_name, int indent) const
702{
703 size_t i;
704 vector<const Variable *> &ctrl_vars = Variable::get_new_ctrl_vars();
705 // declare control variables
706 OutputArrayCtrlVars(ctrl_vars, out, get_dimension(), indent);
707 for (i=0; i<get_dimension(); i++) {
708 output_tab(out, indent);
709 out << "for (";
710 out << ctrl_vars[i]->get_actual_name();
711 out << " = 0; ";
712 out << ctrl_vars[i]->get_actual_name();
713 out << " < " << sizes[i] << "; ";
714 out << ctrl_vars[i]->get_actual_name();
715 if (CGOptions::post_incr_operator()) {
716 out << "++)";
717 }
718 else {
719 out << " = " << ctrl_vars[i]->get_actual_name() << " + 1)";
720 }
721 outputln(out);
722 output_open_encloser("{", out, indent);
723 }
724 output_tab(out, indent);
725 out << "if (";
726 var->Output(out);
727 out << " == &";
728 output_with_indices(out, ctrl_vars);
729 out << field_name;
730 out << ")" << endl;
731 output_open_encloser("{", out, indent);
732 output_tab(out, indent);
733 out << "printf(\" ";
734 var->Output(out);
735 out << " = &";
736 out << get_actual_name();
737 for (i=0; i<get_dimension(); i++) {
738 out << "[%d]";
739 }
740 out << ";\\n\"";
741 for (i=0; i<get_dimension(); i++) {
742 out << ", ";
743 out << ctrl_vars[i]->get_actual_name();
744 }
745 out << ");" << endl;
746 output_tab(out, indent);
747 out << "break;";
748 output_close_encloser("}", out, indent);
749 // output the closing bracelets
750 for (i=0; i<get_dimension(); i++) {
751 output_close_encloser("}", out, indent);
752 }
753}
754
755string
756ArrayVariable::make_print_index_str(const vector<const Variable *> &cvs) const

Callers

nothing calls this directly

Calls 7

OutputArrayCtrlVarsFunction · 0.85
output_tabFunction · 0.85
outputlnFunction · 0.85
output_open_encloserFunction · 0.85
output_close_encloserFunction · 0.85
get_actual_nameMethod · 0.80
OutputMethod · 0.45

Tested by

no test coverage detected