clang-tools 8.0.0

ConcatNestedNamespacesCheck.h
Go to the documentation of this file.
1 //===--- ConcatNestedNamespacesCheck.h - clang-tidy--------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_CONCATNESTEDNAMESPACESCHECK_H
11 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_CONCATNESTEDNAMESPACESCHECK_H
12
13 #include "../ClangTidy.h"
14 #include "llvm/ADT/SmallString.h"
15 #include "llvm/ADT/SmallVector.h"
16
17 namespace clang {
18 namespace tidy {
19 namespace modernize {
20
21 class ConcatNestedNamespacesCheck : public ClangTidyCheck {
22 public:
23 ConcatNestedNamespacesCheck(StringRef Name, ClangTidyContext *Context)
24 : ClangTidyCheck(Name, Context) {}
25 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
26 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
27
28 private:
29 using NamespaceContextVec = llvm::SmallVector<const NamespaceDecl *, 6>;
30 using NamespaceString = llvm::SmallString<40>;
31
32 void reportDiagnostic(const SourceRange &FrontReplacement,
33 const SourceRange &BackReplacement);
34 NamespaceString concatNamespaces();
35 NamespaceContextVec Namespaces;
36 };
37 } // namespace modernize
38 } // namespace tidy
39 } // namespace clang
40
41 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_CONCATNESTEDNAMESPACESCHECK_H
clang::tidy::ClangTidyCheck
Base class for all clang-tidy checks.
Definition: ClangTidy.h:127
clang::tidy::modernize::ConcatNestedNamespacesCheck::ConcatNestedNamespacesCheck
ConcatNestedNamespacesCheck(StringRef Name, ClangTidyContext *Context)
Definition: ConcatNestedNamespacesCheck.h:23
clang::tidy::modernize::ConcatNestedNamespacesCheck::check
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
Definition: ConcatNestedNamespacesCheck.cpp:80
Name
static constexpr llvm::StringLiteral Name
Definition: UppercaseLiteralSuffixCheck.cpp:28
Result
llvm::Optional< llvm::Expected< tooling::AtomicChanges > > Result
Definition: ClangdServer.cpp:60
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ChangeNamespace.cpp:18
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition: ClangTidyDiagnosticConsumer.h:100
clang::tidy::modernize::ConcatNestedNamespacesCheck
Definition: ConcatNestedNamespacesCheck.h:21
clang::tidy::modernize::ConcatNestedNamespacesCheck::registerMatchers
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
Definition: ConcatNestedNamespacesCheck.cpp:64