clang-tools  8.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:
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  llvm::SmallVector<SourceLocation, 4> Ends;
38 };
39 
40 } // namespace readability
41 } // namespace tidy
42 } // namespace clang
43 
44 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_NAMESPACECOMMENTCHECK_H
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
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.
static constexpr llvm::StringLiteral Name
std::map< std::string, std::string > OptionMap
llvm::Optional< llvm::Expected< tooling::AtomicChanges > > Result
Checks that long namespaces have a closing comment.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
NamespaceCommentCheck(StringRef Name, ClangTidyContext *Context)