Skip to content

Commit

Permalink
[clang-tidy] A new OpenMP module
Browse files Browse the repository at this point in the history
Summary:
Just the empty skeleton.
Previously reviewed as part of D57113.

Reviewers: JonasToth, aaron.ballman, alexfh, xazax.hun, hokein, gribozavr

Reviewed By: JonasToth, gribozavr

Subscribers: jdoerfert, mgorny, rnkovacs, guansong, arphaman, cfe-commits

Tags: #clang-tools-extra, #openmp, #clang

Differential Revision: https://reviews.llvm.org/D57571

llvm-svn: 356800
  • Loading branch information
LebedevRI committed Mar 22, 2019
1 parent d5ce571 commit 819bedf
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 0 deletions.
1 change: 1 addition & 0 deletions clang-tools-extra/clang-tidy/CMakeLists.txt
Expand Up @@ -50,6 +50,7 @@ if(CLANG_ENABLE_STATIC_ANALYZER)
add_subdirectory(mpi)
endif()
add_subdirectory(objc)
add_subdirectory(openmp)
add_subdirectory(performance)
add_subdirectory(plugin)
add_subdirectory(portability)
Expand Down
5 changes: 5 additions & 0 deletions clang-tools-extra/clang-tidy/ClangTidyForceLinker.h
Expand Up @@ -77,6 +77,11 @@ static int LLVM_ATTRIBUTE_UNUSED MPIModuleAnchorDestination =
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 =
Expand Down
11 changes: 11 additions & 0 deletions clang-tools-extra/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
)
35 changes: 35 additions & 0 deletions clang-tools-extra/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<OpenMPModule>
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
1 change: 1 addition & 0 deletions clang-tools-extra/clang-tidy/plugin/CMakeLists.txt
Expand Up @@ -21,6 +21,7 @@ add_clang_library(clangTidyPlugin
clangTidyMiscModule
clangTidyModernizeModule
clangTidyObjCModule
clangTidyOpenMPModule
clangTidyPerformanceModule
clangTidyPortabilityModule
clangTidyReadabilityModule
Expand Down
1 change: 1 addition & 0 deletions clang-tools-extra/clang-tidy/tool/CMakeLists.txt
Expand Up @@ -30,6 +30,7 @@ target_link_libraries(clang-tidy
clangTidyMiscModule
clangTidyModernizeModule
clangTidyObjCModule
clangTidyOpenMPModule
clangTidyPerformanceModule
clangTidyPortabilityModule
clangTidyReadabilityModule
Expand Down
4 changes: 4 additions & 0 deletions clang-tools-extra/docs/ReleaseNotes.rst
Expand Up @@ -67,6 +67,10 @@ The improvements are...
Improvements to clang-tidy
--------------------------

- New OpenMP module.

For checks specific to `OpenMP <https://www.openmp.org/>`_ API.

- New :doc:`abseil-duration-addition
<clang-tidy/checks/abseil-duration-addition>` check.

Expand Down
1 change: 1 addition & 0 deletions clang-tools-extra/docs/clang-tidy/index.rst
Expand Up @@ -73,6 +73,7 @@ Name prefix Description
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.
Expand Down

0 comments on commit 819bedf

Please sign in to comment.