10 #include "clang/AST/ASTContext.h" 11 #include "clang/ASTMatchers/ASTMatchFinder.h" 19 void DontModifyStdNamespaceCheck::registerMatchers(MatchFinder *Finder) {
20 if (!getLangOpts().CPlusPlus)
24 namespaceDecl(unless(isExpansionInSystemHeader()),
25 anyOf(hasName(
"std"), hasName(
"posix")),
26 has(decl(unless(anyOf(
33 void DontModifyStdNamespaceCheck::check(
34 const MatchFinder::MatchResult &Result) {
35 const auto *N = Result.Nodes.getNodeAs<NamespaceDecl>(
"nmspc");
38 if (N->getParent() != Result.Context->getTranslationUnitDecl())
41 diag(N->getLocation(),
42 "modification of %0 namespace can result in undefined behavior")
bool isExplicitTemplateSpecialization(const NamedDecl *D)
Indicates if D is an explicit template specialization, e.g.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//