28 const MatchFinder::MatchResult &Result) {
29 const auto *MatchedDecl =
30 Result.Nodes.getNodeAs<Decl>(
"child_of_translation_unit");
31 const auto *NS = dyn_cast<NamespaceDecl>(MatchedDecl);
34 if (NS ==
nullptr || NS->isAnonymousNamespace()) {
35 diag(MatchedDecl->getLocation(),
36 "declaration must be enclosed within the '%0' namespace")
42 if (Result.SourceManager->isMacroBodyExpansion(NS->getLocation()) ==
false) {
43 diag(NS->getLocation(),
"the outermost namespace should be the '%0' macro")
51 if (NS->getVisibility() != Visibility::HiddenVisibility) {
52 diag(NS->getLocation(),
"the '%0' macro should start with '%1'")
59 diag(NS->getLocation(),
"the '%0' macro expansion should start with '%1'")