| 615 | } |
| 616 | |
| 617 | Variable* |
| 618 | VariableSelector::eager_create_local_struct(Block &block, Effect::Access access, const CGContext &cg_context, |
| 619 | const Type* type, const CVQualifiers* qfer, |
| 620 | eMatchType mt, const vector<const Variable*>& invalid_vars) |
| 621 | { |
| 622 | // We will choose a struct with all of its qualifiers. |
| 623 | // choose_var() will rule out invalid field vars. |
| 624 | assert(type); |
| 625 | int level = type->get_indirect_level(); |
| 626 | const Type *t = 0; |
| 627 | if (level == 0) { |
| 628 | t = Type::choose_random_struct_from_type(type, true); |
| 629 | GenerateNewParentLocal(block, access, cg_context, t, qfer); |
| 630 | } |
| 631 | else if (level == 1) { |
| 632 | t = Type::choose_random_struct_from_type(t->ptr_type, true); |
| 633 | if (qfer) { |
| 634 | CVQualifiers qfer1 = qfer->indirect_qualifiers(level); |
| 635 | GenerateNewParentLocal(block, access, cg_context, t, &qfer1); |
| 636 | } |
| 637 | else { |
| 638 | GenerateNewParentLocal(block, access, cg_context, t, qfer); |
| 639 | } |
| 640 | } |
| 641 | else |
| 642 | return NULL; |
| 643 | ERROR_GUARD(NULL); |
| 644 | if (!t) |
| 645 | return NULL; |
| 646 | |
| 647 | ERROR_GUARD(NULL); |
| 648 | return choose_var(block.local_vars, access, cg_context, type, qfer, mt, invalid_vars); |
| 649 | } |
| 650 | |
| 651 | |
| 652 | // -------------------------------------------------------------- |
nothing calls this directly
no test coverage detected