PortabilityTidyModule.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. #include "../ClangTidy.h"
  9. #include "../ClangTidyModule.h"
  10. #include "../ClangTidyModuleRegistry.h"
  11. #include "RestrictSystemIncludesCheck.h"
  12. #include "SIMDIntrinsicsCheck.h"
  13. #include "StdAllocatorConstCheck.h"
  14. namespace clang::tidy {
  15. namespace portability {
  16. class PortabilityModule : public ClangTidyModule {
  17. public:
  18. void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
  19. CheckFactories.registerCheck<RestrictSystemIncludesCheck>(
  20. "portability-restrict-system-includes");
  21. CheckFactories.registerCheck<SIMDIntrinsicsCheck>(
  22. "portability-simd-intrinsics");
  23. CheckFactories.registerCheck<StdAllocatorConstCheck>(
  24. "portability-std-allocator-const");
  25. }
  26. };
  27. // Register the PortabilityModule using this statically initialized variable.
  28. static ClangTidyModuleRegistry::Add<PortabilityModule>
  29. X("portability-module", "Adds portability-related checks.");
  30. } // namespace portability
  31. // This anchor is used to force the linker to link in the generated object file
  32. // and thus register the PortabilityModule.
  33. volatile int PortabilityModuleAnchorSource = 0;
  34. } // namespace clang::tidy