clang-tools  14.0.0git
TypeMismatchCheck.h
Go to the documentation of this file.
1 //===--- TypeMismatchCheck.h - clang-tidy------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MPI_TYPE_MISMATCH_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MPI_TYPE_MISMATCH_H
11 
12 #include "../ClangTidyCheck.h"
13 #include "clang/ASTMatchers/ASTMatchFinder.h"
14 #include "clang/StaticAnalyzer/Checkers/MPIFunctionClassifier.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
28 public:
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  void onEndOfTranslationUnit() override;
36 
37 private:
38  /// Check if the buffer type MPI datatype pairs match.
39  ///
40  /// \param BufferTypes buffer types
41  /// \param BufferExprs buffer arguments as expressions
42  /// \param MPIDatatypes MPI datatype
43  /// \param LO language options
44  void checkArguments(ArrayRef<const Type *> BufferTypes,
45  ArrayRef<const Expr *> BufferExprs,
46  ArrayRef<StringRef> MPIDatatypes, const LangOptions &LO);
47 
48  Optional<ento::mpi::MPIFunctionClassifier> FuncClassifier;
49 };
50 
51 } // namespace mpi
52 } // namespace tidy
53 } // namespace clang
54 
55 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MPI_TYPE_MISMATCH_H
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:242
clang::tidy::mpi::TypeMismatchCheck
This check verifies if buffer type and MPI (Message Passing Interface) datatype pairs match.
Definition: TypeMismatchCheck.h:27
clang::tidy::ClangTidyCheck
Base class for all clang-tidy checks.
Definition: ClangTidyCheck.h:54
clang::tidy::mpi::TypeMismatchCheck::onEndOfTranslationUnit
void onEndOfTranslationUnit() override
Definition: TypeMismatchCheck.cpp:335
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition: ClangTidyDiagnosticConsumer.h:71
Name
static constexpr llvm::StringLiteral Name
Definition: UppercaseLiteralSuffixCheck.cpp:28
clang::tidy::mpi::TypeMismatchCheck::registerMatchers
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
Definition: TypeMismatchCheck.cpp:238
clang::tidy::mpi::TypeMismatchCheck::TypeMismatchCheck
TypeMismatchCheck(StringRef Name, ClangTidyContext *Context)
Definition: TypeMismatchCheck.h:29
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ApplyReplacements.h:27