1 //===-- MPITypes.h - Functionality to model MPI concepts --------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// This file provides definitions to model concepts of MPI. The mpi::Request
12 /// class defines a wrapper class, in order to make MPI requests trackable for
13 /// path-sensitive analysis.
15 //===----------------------------------------------------------------------===//
17 #ifndef LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_MPICHECKER_MPITYPES_H
18 #define LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_MPICHECKER_MPITYPES_H
20 #include "clang/StaticAnalyzer/Checkers/MPIFunctionClassifier.h"
21 #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
22 #include "llvm/ADT/SmallSet.h"
30 enum State : unsigned char { Nonblocking, Wait };
32 Request(State S) : CurrentState{S} {}
34 void Profile(llvm::FoldingSetNodeID &Id) const {
35 Id.AddInteger(CurrentState);
38 bool operator==(const Request &ToCompare) const {
39 return CurrentState == ToCompare.CurrentState;
42 const State CurrentState;
45 // The RequestMap stores MPI requests which are identified by their memory
46 // region. Requests are used in MPI to complete nonblocking operations with wait
47 // operations. A custom map implementation is used, in order to make it
48 // available in an arbitrary amount of translation units.
50 typedef llvm::ImmutableMap<const clang::ento::MemRegion *,
51 clang::ento::mpi::Request>
54 } // end of namespace: mpi
57 struct ProgramStateTrait<mpi::RequestMap>
58 : public ProgramStatePartialTrait<mpi::RequestMapImpl> {
59 static void *GDMIndex() {
65 } // end of namespace: ento
66 } // end of namespace: clang