xref: /llvm-project/clang-tools-extra/clang-tidy/portability/PortabilityTidyModule.cpp (revision 6d8e966512f0b050e84b65c1deed479d5c92fe4c)
1c0e768dfSFangrui Song //===--- PortabilityTidyModule.cpp - clang-tidy ---------------------------===//
2c0e768dfSFangrui Song //
32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6c0e768dfSFangrui Song //
7c0e768dfSFangrui Song //===----------------------------------------------------------------------===//
8c0e768dfSFangrui Song 
9c0e768dfSFangrui Song #include "../ClangTidy.h"
10c0e768dfSFangrui Song #include "../ClangTidyModule.h"
11c0e768dfSFangrui Song #include "../ClangTidyModuleRegistry.h"
12ebdb98f2SPaula Toth #include "RestrictSystemIncludesCheck.h"
13c0e768dfSFangrui Song #include "SIMDIntrinsicsCheck.h"
14b9ca972bSFangrui Song #include "StdAllocatorConstCheck.h"
15*6d8e9665Sisuckatcs #include "TemplateVirtualMemberFunctionCheck.h"
16c0e768dfSFangrui Song 
177d2ea6c4SCarlos Galvez namespace clang::tidy {
18c0e768dfSFangrui Song namespace portability {
19c0e768dfSFangrui Song 
20c0e768dfSFangrui Song class PortabilityModule : public ClangTidyModule {
21c0e768dfSFangrui Song public:
22c0e768dfSFangrui Song   void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
23ebdb98f2SPaula Toth     CheckFactories.registerCheck<RestrictSystemIncludesCheck>(
24ebdb98f2SPaula Toth         "portability-restrict-system-includes");
25c0e768dfSFangrui Song     CheckFactories.registerCheck<SIMDIntrinsicsCheck>(
26c0e768dfSFangrui Song         "portability-simd-intrinsics");
27b9ca972bSFangrui Song     CheckFactories.registerCheck<StdAllocatorConstCheck>(
28b9ca972bSFangrui Song         "portability-std-allocator-const");
29*6d8e9665Sisuckatcs     CheckFactories.registerCheck<TemplateVirtualMemberFunctionCheck>(
30*6d8e9665Sisuckatcs         "portability-template-virtual-member-function");
31c0e768dfSFangrui Song   }
32c0e768dfSFangrui Song };
33c0e768dfSFangrui Song 
34c0e768dfSFangrui Song // Register the PortabilityModule using this statically initialized variable.
35c0e768dfSFangrui Song static ClangTidyModuleRegistry::Add<PortabilityModule>
36c0e768dfSFangrui Song     X("portability-module", "Adds portability-related checks.");
37c0e768dfSFangrui Song 
38c0e768dfSFangrui Song } // namespace portability
39c0e768dfSFangrui Song 
40c0e768dfSFangrui Song // This anchor is used to force the linker to link in the generated object file
41c0e768dfSFangrui Song // and thus register the PortabilityModule.
42c0e768dfSFangrui Song volatile int PortabilityModuleAnchorSource = 0;
43c0e768dfSFangrui Song 
447d2ea6c4SCarlos Galvez } // namespace clang::tidy
45