clang-tools 3.8.0

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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 /// http://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Namespaces
25 class NamespaceCommentCheck : public ClangTidyCheck {
26 public:
27 NamespaceCommentCheck(StringRef Name, ClangTidyContext *Context);
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
clang::tidy::readability::NamespaceCommentCheck::registerMatchers
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register ASTMatchers with Finder.
Definition: NamespaceCommentCheck.cpp:36
Name
StringHandle Name
Definition: PreprocessorTracker.cpp:525
Finder
std::unique_ptr< ast_matchers::MatchFinder > Finder
Definition: ClangTidy.cpp:188
clang::tidy::ClangTidyCheck
Base class for all clang-tidy checks.
Definition: ClangTidy.h:102
clang::tidy::readability::NamespaceCommentCheck::check
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
Definition: NamespaceCommentCheck.cpp:59
clang::tidy::ClangTidyCheck::Options
OptionsView Options
Definition: ClangTidy.h:158
clang::tidy::ClangTidyOptions::OptionMap
std::map< std::string, std::string > OptionMap
Definition: ClangTidyOptions.h:82
clang::tidy::readability::NamespaceCommentCheck
Checks that long namespaces have a closing comment.
Definition: NamespaceCommentCheck.h:25
Context
ClangTidyContext & Context
Definition: ClangTidy.cpp:93
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition: ClangTidyDiagnosticConsumer.h:124
clang::tidy::readability::NamespaceCommentCheck::NamespaceCommentCheck
NamespaceCommentCheck(StringRef Name, ClangTidyContext *Context)
Definition: NamespaceCommentCheck.cpp:22
Result
const NamedDecl * Result
Definition: USRFinder.cpp:121