nixd
Loading...
Searching...
No Matches
libnixt
include
nixt
HackCache.h
Go to the documentation of this file.
1
/// Access EvalCache in \p nix::EvalState
2
3
#pragma once
4
5
#include <nix/eval.hh>
6
7
namespace
nixt
{
8
9
#if HAVE_BOEHMGC
10
using
FileEvalCache
=
11
std::map<nix::SourcePath, nix::Value, std::less<nix::SourcePath>,
12
traceable_allocator<std::pair<const nix::SourcePath, nix::Value>>>;
13
#else
14
using
FileEvalCache
= std::map<nix::SourcePath, nix::Expr *>;
15
#endif
16
17
namespace
detail {
18
19
template
<
typename
Tag>
struct
R
{
20
using
type
=
typename
Tag::type;
21
static
type
P
;
22
};
23
24
template
<
typename
Tag>
typename
R<Tag>::type
R<Tag>::P
;
25
26
template
<
typename
Tag,
typename
Tag::type p>
struct
RB
:
R
<Tag> {
27
struct
F
{
28
F
() {
R<Tag>::P
= p; }
29
};
30
static
F
FO
;
31
};
32
33
template
<
typename
Tag,
typename
Tag::type p>
34
typename
RB<Tag, p>::F
RB<Tag, p>::FO
;
35
36
// Impl
37
38
struct
EvalCacheF
{
39
using
type
=
FileEvalCache
nix::EvalState::*;
40
};
41
42
template
struct
RB<EvalCacheF, &nix::EvalState::fileEvalCache>
;
43
44
}
// namespace detail
45
46
inline
FileEvalCache
&
getFileEvalCache
(nix::EvalState &S) {
47
return
S.*
detail::R<detail::EvalCacheF>::P
;
48
}
49
50
}
// namespace nixt
nixt
Access EvalCache in nix::EvalState.
Definition
ArrayRef.h:7
nixt::FileEvalCache
std::map< nix::SourcePath, nix::Expr * > FileEvalCache
Definition
HackCache.h:14
nixt::getFileEvalCache
FileEvalCache & getFileEvalCache(nix::EvalState &S)
Definition
HackCache.h:46
nixt::detail::EvalCacheF
Definition
HackCache.h:38
nixt::detail::EvalCacheF::type
FileEvalCache nix::EvalState::* type
Definition
HackCache.h:39
nixt::detail::RB::F
Definition
HackCache.h:27
nixt::detail::RB::F::F
F()
Definition
HackCache.h:28
nixt::detail::RB
Definition
HackCache.h:26
nixt::detail::RB::FO
static F FO
Definition
HackCache.h:30
nixt::detail::R
Definition
HackCache.h:19
nixt::detail::R::type
typename Tag::type type
Definition
HackCache.h:20
nixt::detail::R::P
static type P
Definition
HackCache.h:21
Generated by
1.12.0