blob: b72eb65150d99e03b253c66edb828a10ded8641f [file] [log] [blame]
Alexander Kornienkobef51cd2014-05-19 16:39:08 +00001//===--- 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
Alexander Kornienko33fc3db2014-09-22 10:41:39 +000010#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_NAMESPACECOMMENTCHECK_H
11#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_NAMESPACECOMMENTCHECK_H
Alexander Kornienkobef51cd2014-05-19 16:39:08 +000012
13#include "../ClangTidy.h"
14#include "llvm/Support/Regex.h"
15
16namespace clang {
17namespace tidy {
Alexander Kornienko33fc3db2014-09-22 10:41:39 +000018namespace readability {
Alexander Kornienkobef51cd2014-05-19 16:39:08 +000019
20/// \brief Checks that long namespaces have a closing comment.
21///
Alexander Kornienko33fc3db2014-09-22 10:41:39 +000022/// http://llvm.org/docs/CodingStandards.html#namespace-indentation
23/// http://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Namespaces
Alexander Kornienkobef51cd2014-05-19 16:39:08 +000024class NamespaceCommentCheck : public ClangTidyCheck {
25public:
Alexander Kornienko6e0cbc82014-09-12 08:53:36 +000026 NamespaceCommentCheck(StringRef Name, ClangTidyContext *Context);
Alexander Kornienkobef51cd2014-05-19 16:39:08 +000027 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
28 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
29
30private:
Alexander Kornienko6e0cbc82014-09-12 08:53:36 +000031 void storeOptions(ClangTidyOptions::OptionMap &Options) override;
32
Alexander Kornienkobef51cd2014-05-19 16:39:08 +000033 llvm::Regex NamespaceCommentPattern;
34 const unsigned ShortNamespaceLines;
Alexander Kornienko6e0cbc82014-09-12 08:53:36 +000035 const unsigned SpacesBeforeComments;
Alexander Kornienkobef51cd2014-05-19 16:39:08 +000036};
37
Alexander Kornienko33fc3db2014-09-22 10:41:39 +000038} // namespace readability
Alexander Kornienkobef51cd2014-05-19 16:39:08 +000039} // namespace tidy
40} // namespace clang
41
Alexander Kornienko33fc3db2014-09-22 10:41:39 +000042#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_NAMESPACECOMMENTCHECK_H