Daniel Jasper | d07c840 | 2013-07-29 08:19:24 +0000 | [diff] [blame] | 1 | //===--- LLVMTidyModule.cpp - clang-tidy ----------------------------------===// |
| 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 | |
Daniel Jasper | d07c840 | 2013-07-29 08:19:24 +0000 | [diff] [blame] | 10 | #include "../ClangTidy.h" |
| 11 | #include "../ClangTidyModule.h" |
| 12 | #include "../ClangTidyModuleRegistry.h" |
Chandler Carruth | 3cbd71c | 2015-01-14 11:24:38 +0000 | [diff] [blame] | 13 | #include "../readability/NamespaceCommentCheck.h" |
Benjamin Kramer | 498cce5 | 2014-08-13 13:57:57 +0000 | [diff] [blame] | 14 | #include "HeaderGuardCheck.h" |
Alexander Kornienko | bef51cd | 2014-05-19 16:39:08 +0000 | [diff] [blame] | 15 | #include "IncludeOrderCheck.h" |
Benjamin Kramer | 190e2cf | 2014-07-08 14:32:17 +0000 | [diff] [blame] | 16 | #include "TwineLocalCheck.h" |
Daniel Jasper | d07c840 | 2013-07-29 08:19:24 +0000 | [diff] [blame] | 17 | |
| 18 | namespace clang { |
| 19 | namespace tidy { |
Alexander Kornienko | 0a6ce9f | 2015-03-02 12:39:18 +0000 | [diff] [blame] | 20 | namespace llvm { |
Daniel Jasper | d07c840 | 2013-07-29 08:19:24 +0000 | [diff] [blame] | 21 | |
Daniel Jasper | d07c840 | 2013-07-29 08:19:24 +0000 | [diff] [blame] | 22 | class LLVMModule : public ClangTidyModule { |
| 23 | public: |
Alexander Kornienko | 21f3b77 | 2014-03-05 13:01:24 +0000 | [diff] [blame] | 24 | void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { |
Alexander Kornienko | be8c143 | 2014-09-10 11:06:43 +0000 | [diff] [blame] | 25 | CheckFactories.registerCheck<LLVMHeaderGuardCheck>("llvm-header-guard"); |
| 26 | CheckFactories.registerCheck<IncludeOrderCheck>("llvm-include-order"); |
Alexander Kornienko | 33fc3db | 2014-09-22 10:41:39 +0000 | [diff] [blame] | 27 | CheckFactories.registerCheck<readability::NamespaceCommentCheck>( |
Alexander Kornienko | be8c143 | 2014-09-10 11:06:43 +0000 | [diff] [blame] | 28 | "llvm-namespace-comment"); |
| 29 | CheckFactories.registerCheck<TwineLocalCheck>("llvm-twine-local"); |
Daniel Jasper | d07c840 | 2013-07-29 08:19:24 +0000 | [diff] [blame] | 30 | } |
| 31 | }; |
| 32 | |
| 33 | // Register the LLVMTidyModule using this statically initialized variable. |
| 34 | static ClangTidyModuleRegistry::Add<LLVMModule> X("llvm-module", |
| 35 | "Adds LLVM lint checks."); |
| 36 | |
Alexander Kornienko | 0a6ce9f | 2015-03-02 12:39:18 +0000 | [diff] [blame] | 37 | } // namespace llvm |
| 38 | |
Daniel Jasper | d07c840 | 2013-07-29 08:19:24 +0000 | [diff] [blame] | 39 | // This anchor is used to force the linker to link in the generated object file |
| 40 | // and thus register the LLVMModule. |
| 41 | volatile int LLVMModuleAnchorSource = 0; |
| 42 | |
| 43 | } // namespace tidy |
| 44 | } // namespace clang |