9#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_CONCATNESTEDNAMESPACESCHECK_H
10#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_CONCATNESTEDNAMESPACESCHECK_H
12#include "../ClangTidyCheck.h"
13#include "llvm/ADT/SmallString.h"
14#include "llvm/ADT/SmallVector.h"
20class NS :
public llvm::SmallVector<const NamespaceDecl *, 6> {
22 std::optional<SourceRange>
24 const LangOptions &LangOpts)
const;
27 const LangOptions &LangOpts)
const;
40 return LangOpts.CPlusPlus17;
43 void check(
const ast_matchers::MatchFinder::MatchResult &Result)
override;
46 using NamespaceContextVec = llvm::SmallVector<NS, 6>;
48 void reportDiagnostic(
const SourceManager &SM,
const LangOptions &LangOpts);
49 NamespaceContextVec Namespaces;
llvm::SmallString< 256U > Name
Base class for all clang-tidy checks.
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
ConcatNestedNamespacesCheck(StringRef Name, ClangTidyContext *Context)
bool singleNamedNamespaceChild(const NamespaceDecl &ND) const
bool unsupportedNamespace(const NamespaceDecl &ND, bool IsChild) const
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override
Override this to disable registering matchers and PP callbacks if an invalid language version is bein...
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
SourceRange getDefaultNamespaceBackRange() const
void appendName(NamespaceName &Str) const
SourceRange getReplacedNamespaceFrontRange() const
std::optional< SourceRange > getCleanedNamespaceFrontRange(const SourceManager &SM, const LangOptions &LangOpts) const
SourceRange getNamespaceBackRange(const SourceManager &SM, const LangOptions &LangOpts) const
void appendCloseComment(NamespaceName &Str) const
llvm::SmallString< 40 > NamespaceName