Switch a number of loops in lib/CodeGen over to range-based for-loops, now that