The AST matching code that traverses from types to decls misses a lot of possible conversions. This patch adds all of the conversions I could find. However, not all of the type->decl conversions can be used from the AST matchers yet. For instance, we do not have matcher support for ObjCInterfaceDecl. I've added a test case for the one conversion we currently support. I feel it's reasonable to have reduced test coverage for the other types at this point compared to the difficulty of tracking down why simple matchers were failing.
This now allows us to write a matcher like:
varDecl(hasType(namedDecl(hasName("Foo"))))
that matches code like:
typedef int Foo;
Foo f; // matches f
Previously, the hasType(namedDecl()) matcher would only properly match if the type queried was a TagType. Now it can support any type which is traversable to a decl.