1 | //===--- PortabilityTidyModule.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" |
12 | #include "AvoidPragmaOnceCheck.h" |
13 | #include "RestrictSystemIncludesCheck.h" |
14 | #include "SIMDIntrinsicsCheck.h" |
15 | #include "StdAllocatorConstCheck.h" |
16 | #include "TemplateVirtualMemberFunctionCheck.h" |
17 | |
18 | namespace clang::tidy { |
19 | namespace portability { |
20 | |
21 | class PortabilityModule : public ClangTidyModule { |
22 | public: |
23 | void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { |
24 | CheckFactories.registerCheck<AvoidPragmaOnceCheck>( |
25 | CheckName: "portability-avoid-pragma-once"); |
26 | CheckFactories.registerCheck<RestrictSystemIncludesCheck>( |
27 | CheckName: "portability-restrict-system-includes"); |
28 | CheckFactories.registerCheck<SIMDIntrinsicsCheck>( |
29 | CheckName: "portability-simd-intrinsics"); |
30 | CheckFactories.registerCheck<StdAllocatorConstCheck>( |
31 | CheckName: "portability-std-allocator-const"); |
32 | CheckFactories.registerCheck<TemplateVirtualMemberFunctionCheck>( |
33 | CheckName: "portability-template-virtual-member-function"); |
34 | } |
35 | }; |
36 | |
37 | // Register the PortabilityModule using this statically initialized variable. |
38 | static ClangTidyModuleRegistry::Add<PortabilityModule> |
39 | X("portability-module", "Adds portability-related checks."); |
40 | |
41 | } // namespace portability |
42 | |
43 | // This anchor is used to force the linker to link in the generated object file |
44 | // and thus register the PortabilityModule. |
45 | // NOLINTNEXTLINE(misc-use-internal-linkage) |
46 | volatile int PortabilityModuleAnchorSource = 0; |
47 | |
48 | } // namespace clang::tidy |
49 |