Sanity check would be good along with suggestions for how to proceed.
missing-namespace-std works but only in very limited scope:
It can't handle references.
It can't handle pointers.
It can't handle nested template types like MyTemplateClass<std::string>.
I'd be grateful for input on how to do any of these. I presume there's a standard way to get the referenced type or ultimate pointee (so that std::string**** works). There's no need for the check to dig into typedefs as it's only the written type that it's concerned with. My best efforts resulted in odd hangs when parsing the <vector> header.
I imagine you'll want to replace this matcher with something like:
loc(qualType(hasDeclaration(decl(hasAncestor(decl(namespaceDecl(hasName("std")))))), unless(elaboratedType(hasQualifier(anyOf(specifiesNamespace(hasName("std")), hasPrefix(specifiesNamespace(hasName("std")))))))))
(you can pull out duplicate submatchers with auto matcher = ... and reuse it)
The problem is that we don't have hasParent for typeLoc matches, so for
std::X
this will still match "X" (the inner typeloc).
For that you'll need to make sure to have a matcher like:
loc(elaboratedType(namesType(type().bind("root"))))
store the bound types as "visited",
and then make sure when you hit the callback for the first matcher that the type was not visited via an outer elaboratedType already.