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

Method lower_block_for_vars

src/VariableSelector.cpp:784–808  ·  view source on GitHub ↗

* enlarge the block to contains all variables in the list. This is used to create * itemized array variable */

Source from the content-addressed store, hash-verified

782 * itemized array variable
783 */
784Block*
785VariableSelector::lower_block_for_vars(const vector<Block*>& blks, vector<const Variable*>& vars)
786{
787 size_t i, j, len;
788 Block* b = 0;
789 for (j=0; j<blks.size(); j++) {
790 b = blks[j];
791 len = vars.size();
792 for (i=0; i<len; i++) {
793 if (find_variable_in_set(b->local_vars, vars[i]) != -1) {
794 vars.erase(vars.begin() + i);
795 i--;
796 len--;
797 }
798 }
799 if (vars.empty()) {
800 return b;
801 }
802 }
803 // we break out of loop when either all vars have been covered, or
804 // there is no more higher block to go - most likely there are global
805 // variables or pameters in the list - in that case, returning 0
806 // properly indicate only global scope covers all variables
807 return 0;
808}
809
810/*************************************************************************************
811 * find an initializing value for a new variable

Callers

nothing calls this directly

Calls 3

find_variable_in_setFunction · 0.85
sizeMethod · 0.80
beginMethod · 0.80

Tested by

no test coverage detected