teak-llvm/clang-tools-extra/clang-tidy/mpi/MPITidyModule.cpp
Alexander Droste 1512f9a0f9 [clang-tidy] MPIBufferDerefCheck
...
This check verifies if a buffer passed to an MPI (Message Passing Interface)
function is sufficiently dereferenced. Buffers should be passed as a single
pointer or array. As MPI function signatures specify void * for their buffer
types, insufficiently dereferenced buffers can be passed, like for example
as double pointers or multidimensional arrays, without a compiler warning
emitted.

Instructions on how to apply the check can be found at:
https://github.com/0ax1/MPI-Checker/tree/master/examples

Reviewers: Haojian Wu
Differential revision: https://reviews.llvm.org/D22729

llvm-svn: 278553
2016-08-12 19:30:31 +00:00

40 lines
1.2 KiB
C++

//===--- MPITidyModule.cpp - clang-tidy -----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "../ClangTidy.h"
#include "../ClangTidyModule.h"
#include "../ClangTidyModuleRegistry.h"
#include "BufferDerefCheck.h"
#include "TypeMismatchCheck.h"
namespace clang {
namespace tidy {
namespace mpi {
class MPIModule : public ClangTidyModule {
public:
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
CheckFactories.registerCheck<BufferDerefCheck>("mpi-buffer-deref");
CheckFactories.registerCheck<TypeMismatchCheck>("mpi-type-mismatch");
}
};
} // namespace mpi
// Register the MPITidyModule using this statically initialized variable.
static ClangTidyModuleRegistry::Add<mpi::MPIModule>
X("mpi-module", "Adds MPI clang-tidy checks.");
// This anchor is used to force the linker to link in the generated object file
// and thus register the MPIModule.
volatile int MPIModuleAnchorSource = 0;
} // namespace tidy
} // namespace clang