REPOSITORY
rL LLVM
================
Comment at: clang-tidy/misc/MissingNamespaceStdCheck.cpp:21
@@ +20,3 @@
+void MissingNamespaceStdCheck::registerMatchers(MatchFinder *Finder) {
+
Finder->addMatcher(decl(anyOf(fieldDecl(),varDecl())).bind("field_or_variable"),
this);
+}
----------------
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.
http://reviews.llvm.org/D7714
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits