I did this in a different way upstream: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140526/106648.html

I'll try to merge that in, using our fancy new subtree thingy.