Use modern for loops in build.cc and graph.cc So that the logic is easier to read. Test: Presubmits Change-Id: I808874e29b3c47036a443116725300adbe5d0c1b