Return a vector rather than mutating a given one.

This is cleaner and as efficient as before.

Differential Revision: http://llvm-reviews.chandlerc.com/D3284