================ @@ -30,15 +32,18 @@ void ImplementationInNamespaceCheck::check( return; if (const auto *NS = dyn_cast<NamespaceDecl>(MatchedDecl)) { - if (NS->getName() != RequiredNamespace) { - diag(NS->getLocation(), "'%0' needs to be the outermost namespace") - << RequiredNamespace; - } + if (!Result.SourceManager->isMacroBodyExpansion(NS->getLocation())) + diag(NS->getLocation(), + "the outermost namespace should be the '%0' macro") + << RequiredNamespaceMacroName; + else if (!NS->getName().starts_with(RequiredNamespaceStart)) + diag(NS->getLocation(), "the outermost namespace should start with '%0'") + << RequiredNamespaceStart; return; } diag(MatchedDecl->getLocation(), ---------------- gchatelet wrote:
This is the case where we are not in any namespace but the message is misleading. Thx for pointing this out. I'll fix it shortly. https://github.com/llvm/llvm-project/pull/66504 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits