clang  19.0.0git
MPITypes.h
Go to the documentation of this file.
1 //===-- MPITypes.h - Functionality to model MPI concepts --------*- 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 /// \file
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.
13 ///
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_MPICHECKER_MPITYPES_H
17 #define LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_MPICHECKER_MPITYPES_H
18 
21 #include "llvm/ADT/SmallSet.h"
22 
23 namespace clang {
24 namespace ento {
25 namespace mpi {
26 
27 class Request {
28 public:
29  enum State : unsigned char { Nonblocking, Wait };
30 
32 
33  void Profile(llvm::FoldingSetNodeID &Id) const {
34  Id.AddInteger(CurrentState);
35  }
36 
37  bool operator==(const Request &ToCompare) const {
38  return CurrentState == ToCompare.CurrentState;
39  }
40 
42 };
43 
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.
48 struct RequestMap {};
49 typedef llvm::ImmutableMap<const clang::ento::MemRegion *,
52 
53 } // end of namespace: mpi
54 
55 template <>
56 struct ProgramStateTrait<mpi::RequestMap>
57  : public ProgramStatePartialTrait<mpi::RequestMapImpl> {
58  static void *GDMIndex() {
59  static int index = 0;
60  return &index;
61  }
62 };
63 
64 } // end of namespace: ento
65 } // end of namespace: clang
66 #endif
int Id
Definition: ASTDiff.cpp:190
This file defines functionality to identify and classify MPI functions.
MemRegion - The root abstract class for all memory regions.
Definition: MemRegion.h:96
void Profile(llvm::FoldingSetNodeID &Id) const
Definition: MPITypes.h:33
const State CurrentState
Definition: MPITypes.h:41
bool operator==(const Request &ToCompare) const
Definition: MPITypes.h:37
llvm::ImmutableMap< const clang::ento::MemRegion *, clang::ento::mpi::Request > RequestMapImpl
Definition: MPITypes.h:51
The JSON file list parser is used to communicate input to InstallAPI.