AST matcher "refersToType"

I believe I’ve found a mistake in the documentation for the refersToType AST matcher:

The example code makes use of a matcher called class, but I am unable to find such a matcher in the docs, and when I try to use it in clang-query I get a “matcher not found” error.

I’d be happy to make a patch to the docs, but am actually having trouble using the refersToType matcher at the moment. I’m trying to match calls to std::make_unique specialized with a particular class. That is, I want std::make_unique<Demo::Widget>, but not std::make_unique<Something::Else>. I’d also be happy with a way to filter for the correct matches in the MatchCallback.

There’s a stackoverflow post with a complete code example and a couple things I’ve tried available at


You need `refersToType(asString("class Demo::Widget")))`.

Unfortunately this is not very discoverable. I showed some tooling to make this discoverable here: The Future of AST-Matching refactoring tools (EuroLLVM and ACCU) | Steveire's Blog but it's not generally available yet.