Index: clang-tools-extra/trunk/clang-tidy/CMakeLists.txt =================================================================== --- clang-tools-extra/trunk/clang-tidy/CMakeLists.txt +++ clang-tools-extra/trunk/clang-tidy/CMakeLists.txt @@ -50,6 +50,7 @@ add_subdirectory(mpi) endif() add_subdirectory(objc) +add_subdirectory(openmp) add_subdirectory(performance) add_subdirectory(plugin) add_subdirectory(portability) Index: clang-tools-extra/trunk/clang-tidy/ClangTidyForceLinker.h =================================================================== --- clang-tools-extra/trunk/clang-tidy/ClangTidyForceLinker.h +++ clang-tools-extra/trunk/clang-tidy/ClangTidyForceLinker.h @@ -77,6 +77,11 @@ MPIModuleAnchorSource; #endif +// This anchor is used to force the linker to link the OpenMPModule. +extern volatile int OpenMPModuleAnchorSource; +static int LLVM_ATTRIBUTE_UNUSED OpenMPModuleAnchorDestination = + OpenMPModuleAnchorSource; + // This anchor is used to force the linker to link the PerformanceModule. extern volatile int PerformanceModuleAnchorSource; static int LLVM_ATTRIBUTE_UNUSED PerformanceModuleAnchorDestination = Index: clang-tools-extra/trunk/clang-tidy/openmp/CMakeLists.txt =================================================================== --- clang-tools-extra/trunk/clang-tidy/openmp/CMakeLists.txt +++ clang-tools-extra/trunk/clang-tidy/openmp/CMakeLists.txt @@ -0,0 +1,11 @@ +set(LLVM_LINK_COMPONENTS support) + +add_clang_library(clangTidyOpenMPModule + OpenMPTidyModule.cpp + + LINK_LIBS + clangAST + clangASTMatchers + clangBasic + clangTidy + ) Index: clang-tools-extra/trunk/clang-tidy/openmp/OpenMPTidyModule.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/openmp/OpenMPTidyModule.cpp +++ clang-tools-extra/trunk/clang-tidy/openmp/OpenMPTidyModule.cpp @@ -0,0 +1,35 @@ +//===--- OpenMPTidyModule.cpp - clang-tidy--------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "../ClangTidy.h" +#include "../ClangTidyModule.h" +#include "../ClangTidyModuleRegistry.h" + +namespace clang { +namespace tidy { +namespace openmp { + +/// This module is for OpenMP-specific checks. +class OpenMPModule : public ClangTidyModule { +public: + void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { + } +}; + +// Register the OpenMPTidyModule using this statically initialized variable. +static ClangTidyModuleRegistry::Add + X("openmp-module", "Adds OpenMP-specific checks."); + +} // namespace openmp + +// This anchor is used to force the linker to link in the generated object file +// and thus register the OpenMPModule. +volatile int OpenMPModuleAnchorSource = 0; + +} // namespace tidy +} // namespace clang Index: clang-tools-extra/trunk/clang-tidy/plugin/CMakeLists.txt =================================================================== --- clang-tools-extra/trunk/clang-tidy/plugin/CMakeLists.txt +++ clang-tools-extra/trunk/clang-tidy/plugin/CMakeLists.txt @@ -21,6 +21,7 @@ clangTidyMiscModule clangTidyModernizeModule clangTidyObjCModule + clangTidyOpenMPModule clangTidyPerformanceModule clangTidyPortabilityModule clangTidyReadabilityModule Index: clang-tools-extra/trunk/clang-tidy/tool/CMakeLists.txt =================================================================== --- clang-tools-extra/trunk/clang-tidy/tool/CMakeLists.txt +++ clang-tools-extra/trunk/clang-tidy/tool/CMakeLists.txt @@ -30,6 +30,7 @@ clangTidyMiscModule clangTidyModernizeModule clangTidyObjCModule + clangTidyOpenMPModule clangTidyPerformanceModule clangTidyPortabilityModule clangTidyReadabilityModule Index: clang-tools-extra/trunk/docs/ReleaseNotes.rst =================================================================== --- clang-tools-extra/trunk/docs/ReleaseNotes.rst +++ clang-tools-extra/trunk/docs/ReleaseNotes.rst @@ -67,6 +67,10 @@ Improvements to clang-tidy -------------------------- +- New OpenMP module. + + For checks specific to `OpenMP `_ API. + - New :doc:`abseil-duration-addition ` check. Index: clang-tools-extra/trunk/docs/clang-tidy/index.rst =================================================================== --- clang-tools-extra/trunk/docs/clang-tidy/index.rst +++ clang-tools-extra/trunk/docs/clang-tidy/index.rst @@ -73,6 +73,7 @@ means "C++11") language constructs. ``mpi-`` Checks related to MPI (Message Passing Interface). ``objc-`` Checks related to Objective-C coding conventions. +``openmp-`` Checks related to OpenMP API. ``performance-`` Checks that target performance-related issues. ``portability-`` Checks that target portability-related issues that don't relate to any particular coding style.