clang-tools  4.0.0
NamespaceCommentCheck.h
Go to the documentation of this file.
1 //===--- NamespaceCommentCheck.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_READABILITY_NAMESPACECOMMENTCHECK_H
11 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_NAMESPACECOMMENTCHECK_H
12 
13 #include "../ClangTidy.h"
14 #include "llvm/Support/Regex.h"
15 
16 namespace clang {
17 namespace tidy {
18 namespace readability {
19 
20 /// Checks that long namespaces have a closing comment.
21 ///
22 /// http://llvm.org/docs/CodingStandards.html#namespace-indentation
23 ///
24 /// https://google.github.io/styleguide/cppguide.html#Namespaces
26 public:
28  void registerMatchers(ast_matchers::MatchFinder *Finder) override;
29  void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
30 
31 private:
32  void storeOptions(ClangTidyOptions::OptionMap &Options) override;
33 
34  llvm::Regex NamespaceCommentPattern;
35  const unsigned ShortNamespaceLines;
36  const unsigned SpacesBeforeComments;
37 };
38 
39 } // namespace readability
40 } // namespace tidy
41 } // namespace clang
42 
43 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_NAMESPACECOMMENTCHECK_H
const std::string Name
Definition: USRFinder.cpp:164
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
std::unique_ptr< ast_matchers::MatchFinder > Finder
Definition: ClangTidy.cpp:262
Base class for all clang-tidy checks.
Definition: ClangTidy.h:127
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
std::map< std::string, std::string > OptionMap
Checks that long namespaces have a closing comment.
ClangTidyContext & Context
Definition: ClangTidy.cpp:87
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
NamespaceCommentCheck(StringRef Name, ClangTidyContext *Context)
const NamedDecl * Result
Definition: USRFinder.cpp:162