OpenMPTidyModule.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //===--- OpenMPTidyModule.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 "ExceptionEscapeCheck.h"
  12. #include "UseDefaultNoneCheck.h"
  13. namespace clang::tidy {
  14. namespace openmp {
  15. /// This module is for OpenMP-specific checks.
  16. class OpenMPModule : public ClangTidyModule {
  17. public:
  18. void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
  19. CheckFactories.registerCheck<ExceptionEscapeCheck>(
  20. "openmp-exception-escape");
  21. CheckFactories.registerCheck<UseDefaultNoneCheck>(
  22. "openmp-use-default-none");
  23. }
  24. };
  25. // Register the OpenMPTidyModule using this statically initialized variable.
  26. static ClangTidyModuleRegistry::Add<OpenMPModule>
  27. X("openmp-module", "Adds OpenMP-specific checks.");
  28. } // namespace openmp
  29. // This anchor is used to force the linker to link in the generated object file
  30. // and thus register the OpenMPModule.
  31. volatile int OpenMPModuleAnchorSource = 0;
  32. } // namespace clang::tidy