Now Preferred is always the canonical (first) decl, Definition is always the def
if available.
In practice the index was already forcing this behaviour anyway, so there's no
change. (Unless you weren't using this index, in which case this patch makes
textDocument/declaration and toggling work as expected).
Is it possible for this check to ever fail? I think it is safe to just perform a llvm::cast instead of dyn_cast.
also why not perform this before getting definition?