Better diagnostics for class' source location
(cherry picked from commit c4d36e6)