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

Method record_pointer_comparisons

src/Bookkeeper.cpp:381–401  ·  view source on GitHub ↗

* record the LHS/RHS types of comparisons between pointers */

Source from the content-addressed store, hash-verified

379 * record the LHS/RHS types of comparisons between pointers
380 */
381void
382Bookkeeper::record_pointer_comparisons(const Expression* lhs, const Expression* rhs)
383{
384 if (lhs->term_type != eFunction && rhs->term_type != eFunction) {
385 assert(lhs->get_type().eType == ePointer && rhs->get_type().eType == ePointer);
386 if ((lhs->term_type == eVariable && rhs->term_type == eConstant) ||
387 (rhs->term_type == eVariable && lhs->term_type == eConstant)) {
388 cmp_ptr_to_null++;
389 }
390 else if (lhs->term_type==eVariable && rhs->term_type==eVariable) {
391 const ExpressionVariable* left = (ExpressionVariable*)lhs;
392 const ExpressionVariable* right = (ExpressionVariable*)rhs;
393 if (left->get_indirect_level() == right->get_indirect_level()) {
394 cmp_ptr_to_ptr++;
395 }
396 else {
397 cmp_ptr_to_addr++;
398 }
399 }
400 }
401}
402
403/*
404 * count volatile/non-volatile reads/writes, specifically access thru pointers

Callers

nothing calls this directly

Calls 2

get_typeMethod · 0.45
get_indirect_levelMethod · 0.45

Tested by

no test coverage detected