11 #include "clang/AST/ASTContext.h"
12 #include "clang/ASTMatchers/ASTMatchFinder.h"
20 void NoInternalDependenciesCheck::registerMatchers(MatchFinder *Finder) {
25 nestedNameSpecifierLoc(loc(specifiesNamespace(namespaceDecl(
26 matchesName(
"internal"),
27 hasParent(namespaceDecl(hasName(
"absl")))))),
28 unless(isInAbseilFile()))
33 void NoInternalDependenciesCheck::check(
const MatchFinder::MatchResult &Result) {
34 const auto *InternalDependency =
35 Result.Nodes.getNodeAs<NestedNameSpecifierLoc>(
"InternalDep");
37 SourceLocation LocAtFault =
38 Result.SourceManager->getSpellingLoc(InternalDependency->getBeginLoc());
40 if (!LocAtFault.isValid())
44 "do not reference any 'internal' namespaces; those implementation "
45 "details are reserved to Abseil");