[AST] Add introspection support for more base nodes

Fix the logic of detecting pseudo-virtual getBeginLoc etc on Stmt and
Decl subclasses.

Adjust the test infrastructure to filter out invalid source locations.
This makes the tests more clear about which nodes have which locations.

Differential Revision: https://reviews.llvm.org/D99231

GitOrigin-RevId: f347f0e0b869be4f9b97f26663cf8e4eac2c4868
5 files changed