Fixes some entities not being marked as referenced despite being used in source code. Also ties diagnostic-of-use to such references, because I don't think there is a reason to have one without the other, even though I can't think of a diagnosable entity which was not already covered before.