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

Method Output

src/ArrayVariable.cpp:562–596  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

560
561// --------------------------------------------------------------
562void
563ArrayVariable::Output(std::ostream &out) const
564{
565 if (collective == 0) {
566 out << get_actual_name();
567 }
568 // for itemized array variables, output the modularized index
569 else {
570 out << get_actual_name();
571 assert(!indices.empty());
572 size_t i;
573 for (i=0; i<indices.size(); i++) {
574 if (1) { //indices[i]->less_than(sizes[i])) {
575 out << "[";
576 indices[i]->Output(out);
577 out << "]";
578 }
579 else {
580 out << "[";
581 const Type* t = &(indices[i]->get_type());
582 // cast signed variable to it's corresponding unsigned type, just in case we get a negative index
583 if (t->is_signed()) {
584 const Type* unsigned_type = t->to_unsigned();
585 assert(unsigned_type);
586 out << "(";
587 unsigned_type->Output(out);
588 out << ")";
589 }
590 out << "(";
591 indices[i]->Output(out);
592 out << ") % " << sizes[i] << "]";
593 }
594 }
595 }
596}
597
598void
599ArrayVariable::OutputUpperBound(std::ostream &out) const

Callers 4

output_with_indicesMethod · 0.45
output_initMethod · 0.45
output_addr_checksMethod · 0.45

Calls 4

sizeMethod · 0.80
is_signedMethod · 0.80
to_unsignedMethod · 0.80
get_typeMethod · 0.45

Tested by

no test coverage detected