-
Notifications
You must be signed in to change notification settings - Fork 155
Expand file tree
/
Copy pathSparseCFGBase.h
More file actions
44 lines (36 loc) · 1.44 KB
/
SparseCFGBase.h
File metadata and controls
44 lines (36 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/******************************************************************************
* Copyright (c) 2024 Fabian Schiebel.
* All rights reserved. This program and the accompanying materials are made
* available under the terms of LICENSE.txt.
*
* Contributors:
* Fabian Schiebel and others
*****************************************************************************/
#ifndef PHASAR_CONTROLFLOW_SPARSECFGBASE_H
#define PHASAR_CONTROLFLOW_SPARSECFGBASE_H
#include "phasar/ControlFlow/CFGBase.h"
#include "phasar/Utils/ByRef.h"
#include "phasar/Utils/Nullable.h"
namespace psr {
template <typename Derived> class SparseCFGBase : public CFGBase<Derived> {
public:
using typename CFGBase<Derived>::n_t;
using typename CFGBase<Derived>::f_t;
/// Gets the next instruction in control-flow order, starting from
/// FromInstruction, that may use or define Val.
/// If the next user is ambiguous, returns null.
[[nodiscard]] Nullable<n_t>
nextUserOrNull(ByConstRef<n_t> FromInstruction) const {
return self().nextUserOrNullImpl(FromInstruction);
}
protected:
using CFGBase<Derived>::self;
};
template <typename ICF, typename Domain>
// NOLINTNEXTLINE(readability-identifier-naming)
constexpr bool is_sparse_cfg_v =
is_crtp_base_of_v<SparseCFGBase, ICF> &&
std::is_same_v<typename ICF::n_t, typename Domain::n_t> &&
std::is_same_v<typename ICF::f_t, typename Domain::f_t>;
} // namespace psr
#endif // PHASAR_CONTROLFLOW_SPARSECFGBASE_H