mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-20 03:55:48 -04:00

... 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
40 lines
1.2 KiB
C++
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
|