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

Method hash

src/Variable.cpp:950–987  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

948}
949
950void
951Variable::hash(std::ostream& out) const
952{
953 if (type->is_aggregate()) {
954 size_t i;
955 FactMgr* fm = get_fact_mgr_for_func(GetFirstFunction());
956 for (i=0; i<field_vars.size(); i++) {
957 if (type->eType == eUnion && !FactUnion::is_field_readable(this, i, fm->global_facts)) {
958 // don't read union fields that is not last written into or have possible padding bits
959 continue;
960 }
961 field_vars[i]->hash(out);
962 }
963 }
964 else if (type->eType == eSimple) {
965 if (CGOptions::compute_hash()) {
966 // FIXME handle double here too, once we generate those
967 if (type->simple_type == eFloat) {
968 out << " transparent_crc_bytes (&";
969 Output(out);
970 out << ", sizeof(";
971 Output(out);
972 out << "), \"" << name << "\", print_hash_value);" << endl;
973 } else {
974 out << " transparent_crc(";
975 Output(out);
976 out << ", \"" << name << "\", print_hash_value);" << endl;
977 }
978 }
979 else {
980 out << " " << Variable::sink_var_name << " = ";
981 Output(out);
982 out << ";" << endl;
983 }
984 }
985 else if (type->eType == ePointer) {
986 }
987}
988
989// --------------------------------------------------------------
990int

Callers 1

HashVariableFunction · 0.45

Calls 4

get_fact_mgr_for_funcFunction · 0.85
GetFirstFunctionFunction · 0.85
sizeMethod · 0.80
is_aggregateMethod · 0.45

Tested by

no test coverage detected