-------------------------------------------------------------- Select a random global variable.
| 652 | // -------------------------------------------------------------- |
| 653 | // Select a random global variable. |
| 654 | Variable * |
| 655 | VariableSelector::SelectGlobal(Effect::Access access, const CGContext &cg_context, const Type* type, const CVQualifiers* qfer, eMatchType mt, const vector<const Variable*>& invalid_vars) |
| 656 | { |
| 657 | Variable* var = choose_var(GlobalList, access, cg_context, type, qfer, mt, invalid_vars); |
| 658 | ERROR_GUARD(NULL); |
| 659 | if (var == 0) { |
| 660 | if (CGOptions::expand_struct()) { |
| 661 | var = VariableSelector::eager_create_global_struct(access, cg_context, type, qfer, mt, invalid_vars); |
| 662 | ERROR_GUARD(NULL); |
| 663 | if (var) |
| 664 | return var; |
| 665 | } |
| 666 | |
| 667 | DEPTH_GUARD_BY_TYPE_RETURN(dtSelectGlobal, NULL); |
| 668 | bool no_volatile = false; |
| 669 | if (qfer && !qfer->wildcard && !qfer->is_volatile()) { |
| 670 | no_volatile = true; |
| 671 | } |
| 672 | const Type* t = Type::random_type_from_type(type, no_volatile); |
| 673 | ERROR_GUARD(NULL); |
| 674 | return GenerateNewGlobal(access, cg_context, t, qfer); |
| 675 | } |
| 676 | return var; |
| 677 | } |
| 678 | |
| 679 | void |
| 680 | VariableSelector::find_all_non_bitfield_visible_vars(const Block *b, vector<Variable*> &vars) |
nothing calls this directly
no test coverage detected