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 
22 public:
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
Base class for all clang-tidy checks.
Definition: ClangTidy.h:127
ConcatNestedNamespacesCheck(StringRef Name, ClangTidyContext *Context)
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
static constexpr llvm::StringLiteral Name
llvm::Optional< llvm::Expected< tooling::AtomicChanges > > Result
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.