11#include "clang/AST/ASTContext.h"
12#include "clang/ASTMatchers/ASTMatchFinder.h"
23 nestedNameSpecifierLoc(loc(specifiesNamespace(namespaceDecl(
24 matchesName(
"internal"),
25 hasParent(namespaceDecl(hasName(
"absl")))))),
26 unless(isInAbseilFile()))
32 const auto *InternalDependency =
33 Result.Nodes.getNodeAs<NestedNameSpecifierLoc>(
"InternalDep");
35 SourceLocation LocAtFault =
36 Result.SourceManager->getSpellingLoc(InternalDependency->getBeginLoc());
38 if (!LocAtFault.isValid())
42 "do not reference any 'internal' namespaces; those implementation "
43 "details are reserved to Abseil");
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.