11#include "clang/AST/ASTContext.h"
12#include "clang/ASTMatchers/ASTMatchFinder.h"
20 namespaceDecl(hasName(
"::absl"), unless(isInAbseilFile()))
21 .bind(
"abslNamespace"),
26 const auto *AbslNamespaceDecl =
27 Result.Nodes.getNodeAs<NamespaceDecl>(
"abslNamespace");
29 diag(AbslNamespaceDecl->getLocation(),
30 "namespace 'absl' is reserved for implementation of the Abseil library "
31 "and should not be opened in user code");
DiagnosticBuilder diag(SourceLocation Loc, StringRef Description, DiagnosticIDs::Level Level=DiagnosticIDs::Warning)
Add a diagnostic with the check's name.
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.