clang
15.0.0git
lib
StaticAnalyzer
Checkers
MPI-Checker
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
19
#include "
clang/StaticAnalyzer/Checkers/MPIFunctionClassifier.h
"
20
#include "
clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
"
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
31
Request
(
State
S) :
CurrentState
{S} {}
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
41
const
State
CurrentState
;
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
*,
50
clang::ento::mpi::Request
>
51
RequestMapImpl
;
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
clang::ento::ProgramStatePartialTrait
Definition:
ProgramStateTrait.h:29
clang::ento::mpi::Request::Profile
void Profile(llvm::FoldingSetNodeID &Id) const
Definition:
MPITypes.h:33
clang::ento::mpi::Request::CurrentState
const State CurrentState
Definition:
MPITypes.h:41
CallEvent.h
clang::ento::mpi::Request::Request
Request(State S)
Definition:
MPITypes.h:31
clang::ento::MemRegion
MemRegion - The root abstract class for all memory regions.
Definition:
MemRegion.h:95
MPIFunctionClassifier.h
Id
int Id
Definition:
ASTDiff.cpp:191
clang::ento::mpi::Request
Definition:
MPITypes.h:27
clang::ento::ProgramStateTrait
Definition:
ProgramState.h:50
clang::ento::ProgramStateTrait< mpi::RequestMap >::GDMIndex
static void * GDMIndex()
Definition:
MPITypes.h:58
clang::ento::mpi::Request::Wait
@ Wait
Definition:
MPITypes.h:29
clang::ento::mpi::Request::State
State
Definition:
MPITypes.h:29
clang::ento::mpi::RequestMap
Definition:
MPITypes.h:48
clang::ento::mpi::RequestMapImpl
llvm::ImmutableMap< const clang::ento::MemRegion *, clang::ento::mpi::Request > RequestMapImpl
Definition:
MPITypes.h:51
clang
Definition:
CalledOnceCheck.h:17
clang::ento::mpi::Request::Nonblocking
@ Nonblocking
Definition:
MPITypes.h:29
clang::ento::mpi::Request::operator==
bool operator==(const Request &ToCompare) const
Definition:
MPITypes.h:37
Generated on Sat Jun 25 2022 12:43:00 for clang by
1.8.17