Alexander Kornienko | bef51cd | 2014-05-19 16:39:08 +0000 | [diff] [blame] | 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 | |
Alexander Kornienko | 33fc3db | 2014-09-22 10:41:39 +0000 | [diff] [blame] | 10 | #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_NAMESPACECOMMENTCHECK_H |
| 11 | #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_NAMESPACECOMMENTCHECK_H |
Alexander Kornienko | bef51cd | 2014-05-19 16:39:08 +0000 | [diff] [blame] | 12 | |
| 13 | #include "../ClangTidy.h" |
| 14 | #include "llvm/Support/Regex.h" |
| 15 | |
| 16 | namespace clang { |
| 17 | namespace tidy { |
Alexander Kornienko | 33fc3db | 2014-09-22 10:41:39 +0000 | [diff] [blame] | 18 | namespace readability { |
Alexander Kornienko | bef51cd | 2014-05-19 16:39:08 +0000 | [diff] [blame] | 19 | |
Alexander Kornienko | f8ed0a8 | 2015-08-27 18:01:58 +0000 | [diff] [blame] | 20 | /// Checks that long namespaces have a closing comment. |
Alexander Kornienko | bef51cd | 2014-05-19 16:39:08 +0000 | [diff] [blame] | 21 | /// |
Alexander Kornienko | 33fc3db | 2014-09-22 10:41:39 +0000 | [diff] [blame] | 22 | /// http://llvm.org/docs/CodingStandards.html#namespace-indentation |
Alexander Kornienko | f8ed0a8 | 2015-08-27 18:01:58 +0000 | [diff] [blame] | 23 | /// |
Haojian Wu | bd63972 | 2016-02-25 14:31:10 +0000 | [diff] [blame] | 24 | /// https://google.github.io/styleguide/cppguide.html#Namespaces |
Alexander Kornienko | bef51cd | 2014-05-19 16:39:08 +0000 | [diff] [blame] | 25 | class NamespaceCommentCheck : public ClangTidyCheck { |
| 26 | public: |
Alexander Kornienko | 6e0cbc8 | 2014-09-12 08:53:36 +0000 | [diff] [blame] | 27 | NamespaceCommentCheck(StringRef Name, ClangTidyContext *Context); |
Alexander Kornienko | bef51cd | 2014-05-19 16:39:08 +0000 | [diff] [blame] | 28 | void registerMatchers(ast_matchers::MatchFinder *Finder) override; |
| 29 | void check(const ast_matchers::MatchFinder::MatchResult &Result) override; |
| 30 | |
| 31 | private: |
Alexander Kornienko | 6e0cbc8 | 2014-09-12 08:53:36 +0000 | [diff] [blame] | 32 | void storeOptions(ClangTidyOptions::OptionMap &Options) override; |
| 33 | |
Alexander Kornienko | bef51cd | 2014-05-19 16:39:08 +0000 | [diff] [blame] | 34 | llvm::Regex NamespaceCommentPattern; |
| 35 | const unsigned ShortNamespaceLines; |
Alexander Kornienko | 6e0cbc8 | 2014-09-12 08:53:36 +0000 | [diff] [blame] | 36 | const unsigned SpacesBeforeComments; |
Alexander Kornienko | 5a65e67 | 2018-01-11 13:00:28 +0000 | [diff] [blame] | 37 | llvm::SmallVector<SourceLocation, 4> Ends; |
Alexander Kornienko | bef51cd | 2014-05-19 16:39:08 +0000 | [diff] [blame] | 38 | }; |
| 39 | |
Alexander Kornienko | 33fc3db | 2014-09-22 10:41:39 +0000 | [diff] [blame] | 40 | } // namespace readability |
Alexander Kornienko | bef51cd | 2014-05-19 16:39:08 +0000 | [diff] [blame] | 41 | } // namespace tidy |
| 42 | } // namespace clang |
| 43 | |
Alexander Kornienko | 33fc3db | 2014-09-22 10:41:39 +0000 | [diff] [blame] | 44 | #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_NAMESPACECOMMENTCHECK_H |