clang-tools 6.0.0

TypeMismatchCheck.h
Go to the documentation of this file.
1 //===--- TypeMismatchCheck.h - clang-tidy------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MPI_TYPE_MISMATCH_H
11 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MPI_TYPE_MISMATCH_H
12
13 #include "../ClangTidy.h"
14 #include "clang/ASTMatchers/ASTMatchFinder.h"
15
16 namespace clang {
17 namespace tidy {
18 namespace mpi {
19
20 /// This check verifies if buffer type and MPI (Message Passing Interface)
21 /// datatype pairs match. All MPI datatypes defined by the MPI standard (3.1)
22 /// are verified by this check. User defined typedefs, custom MPI datatypes and
23 /// null pointer constants are skipped, in the course of verification.
24 ///
25 /// For the user-facing documentation see:
26 /// http://clang.llvm.org/extra/clang-tidy/checks/mpi-type-mismatch.html
27 class TypeMismatchCheck : public ClangTidyCheck {
28 public:
29 TypeMismatchCheck(StringRef Name, ClangTidyContext *Context)
30 : ClangTidyCheck(Name, Context) {}
31
32 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
33 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
34
35 private:
36 /// Check if the buffer type MPI datatype pairs match.
37 ///
38 /// \param BufferTypes buffer types
39 /// \param BufferExprs buffer arguments as expressions
40 /// \param MPIDatatypes MPI datatype
41 /// \param LO language options
42 void checkArguments(ArrayRef<const Type *> BufferTypes,
43 ArrayRef<const Expr *> BufferExprs,
44 ArrayRef<StringRef> MPIDatatypes, const LangOptions &LO);
45 };
46
47 } // namespace mpi
48 } // namespace tidy
49 } // namespace clang
50
51 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MPI_TYPE_MISMATCH_H
Name
StringHandle Name
Definition: PreprocessorTracker.cpp:525
clang::tidy::mpi::TypeMismatchCheck
This check verifies if buffer type and MPI (Message Passing Interface) datatype pairs match...
Definition: TypeMismatchCheck.h:27
clang::tidy::mpi::TypeMismatchCheck::check
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
Definition: TypeMismatchCheck.cpp:244
clang::tidy::ClangTidyCheck
Base class for all clang-tidy checks.
Definition: ClangTidy.h:127
clang::tidy::mpi::TypeMismatchCheck::registerMatchers
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
Definition: TypeMismatchCheck.cpp:240
clang
Definition: AndroidTidyModule.cpp:28
clang::tidy::mpi::TypeMismatchCheck::TypeMismatchCheck
TypeMismatchCheck(StringRef Name, ClangTidyContext *Context)
Definition: TypeMismatchCheck.h:29
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition: ClangTidyDiagnosticConsumer.h:104