1 //===-- MPITypes.h - Functionality to model MPI concepts --------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
10 /// This file provides definitions to model concepts of MPI. The mpi::Request
11 /// class defines a wrapper class, in order to make MPI requests trackable for
12 /// path-sensitive analysis.
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_MPICHECKER_MPITYPES_H
17 #define LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_MPICHECKER_MPITYPES_H
19 #include "clang/StaticAnalyzer/Checkers/MPIFunctionClassifier.h"
20 #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
21 #include "llvm/ADT/SmallSet.h"
29 enum State : unsigned char { Nonblocking, Wait };
31 Request(State S) : CurrentState{S} {}
33 void Profile(llvm::FoldingSetNodeID &Id) const {
34 Id.AddInteger(CurrentState);
37 bool operator==(const Request &ToCompare) const {
38 return CurrentState == ToCompare.CurrentState;
41 const State CurrentState;
44 // The RequestMap stores MPI requests which are identified by their memory
45 // region. Requests are used in MPI to complete nonblocking operations with wait
46 // operations. A custom map implementation is used, in order to make it
47 // available in an arbitrary amount of translation units.
49 typedef llvm::ImmutableMap<const clang::ento::MemRegion *,
50 clang::ento::mpi::Request>
53 } // end of namespace: mpi
56 struct ProgramStateTrait<mpi::RequestMap>
57 : public ProgramStatePartialTrait<mpi::RequestMapImpl> {
58 static void *GDMIndex() {
64 } // end of namespace: ento
65 } // end of namespace: clang