Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:21

0001 //===--- TypeMismatchCheck.h - clang-tidy------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MPI_TYPE_MISMATCH_H
0010 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MPI_TYPE_MISMATCH_H
0011 
0012 #include "../ClangTidyCheck.h"
0013 #include "clang/ASTMatchers/ASTMatchFinder.h"
0014 #include "clang/StaticAnalyzer/Checkers/MPIFunctionClassifier.h"
0015 #include <optional>
0016 
0017 namespace clang::tidy::mpi {
0018 
0019 /// This check verifies if buffer type and MPI (Message Passing Interface)
0020 /// datatype pairs match. All MPI datatypes defined by the MPI standard (3.1)
0021 /// are verified by this check. User defined typedefs, custom MPI datatypes and
0022 /// null pointer constants are skipped, in the course of verification.
0023 ///
0024 /// For the user-facing documentation see:
0025 /// http://clang.llvm.org/extra/clang-tidy/checks/mpi/type-mismatch.html
0026 class TypeMismatchCheck : public ClangTidyCheck {
0027 public:
0028   TypeMismatchCheck(StringRef Name, ClangTidyContext *Context)
0029       : ClangTidyCheck(Name, Context) {}
0030 
0031   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
0032   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
0033 
0034   void onEndOfTranslationUnit() override;
0035 
0036 private:
0037   /// Check if the buffer type MPI datatype pairs match.
0038   ///
0039   /// \param BufferTypes buffer types
0040   /// \param BufferExprs buffer arguments as expressions
0041   /// \param MPIDatatypes MPI datatype
0042   /// \param LO language options
0043   void checkArguments(ArrayRef<const Type *> BufferTypes,
0044                       ArrayRef<const Expr *> BufferExprs,
0045                       ArrayRef<StringRef> MPIDatatypes, const LangOptions &LO);
0046 
0047   std::optional<ento::mpi::MPIFunctionClassifier> FuncClassifier;
0048 };
0049 
0050 } // namespace clang::tidy::mpi
0051 
0052 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MPI_TYPE_MISMATCH_H