Paula Toth | eb41cc6 | 2020-03-12 11:38:05 -0700 | [diff] [blame] | 1 | //===--- LLVMLibcTidyModule.cpp - clang-tidy ------------------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "../ClangTidy.h" |
| 10 | #include "../ClangTidyModule.h" |
| 11 | #include "../ClangTidyModuleRegistry.h" |
Paula Toth | 8683f5d | 2020-04-28 17:22:16 -0700 | [diff] [blame] | 12 | #include "CalleeNamespaceCheck.h" |
Paula Toth | 00a5755 | 2020-04-06 10:40:50 -0700 | [diff] [blame] | 13 | #include "ImplementationInNamespaceCheck.h" |
Paula Toth | eb41cc6 | 2020-03-12 11:38:05 -0700 | [diff] [blame] | 14 | #include "RestrictSystemLibcHeadersCheck.h" |
| 15 | |
| 16 | namespace clang { |
| 17 | namespace tidy { |
| 18 | namespace llvm_libc { |
| 19 | |
| 20 | class LLVMLibcModule : public ClangTidyModule { |
| 21 | public: |
| 22 | void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { |
Paula Toth | 8683f5d | 2020-04-28 17:22:16 -0700 | [diff] [blame] | 23 | CheckFactories.registerCheck<CalleeNamespaceCheck>( |
| 24 | "llvmlibc-callee-namespace"); |
Paula Toth | 00a5755 | 2020-04-06 10:40:50 -0700 | [diff] [blame] | 25 | CheckFactories.registerCheck<ImplementationInNamespaceCheck>( |
| 26 | "llvmlibc-implementation-in-namespace"); |
Paula Toth | eb41cc6 | 2020-03-12 11:38:05 -0700 | [diff] [blame] | 27 | CheckFactories.registerCheck<RestrictSystemLibcHeadersCheck>( |
| 28 | "llvmlibc-restrict-system-libc-headers"); |
| 29 | } |
| 30 | }; |
| 31 | |
| 32 | // Register the LLVMLibcTidyModule using this statically initialized variable. |
| 33 | static ClangTidyModuleRegistry::Add<LLVMLibcModule> |
| 34 | X("llvmlibc-module", "Adds LLVM libc standards checks."); |
| 35 | |
| 36 | } // namespace llvm_libc |
| 37 | |
| 38 | // This anchor is used to force the linker to link in the generated object file |
| 39 | // and thus register the LLVMLibcModule. |
| 40 | volatile int LLVMLibcModuleAnchorSource = 0; |
| 41 | |
| 42 | } // namespace tidy |
| 43 | } // namespace clang |