A fix to TreeDiffer, and a different approach to generated sources evaluation.

Note: sync from internal changes already reviewed internally at google.