/src/CMake/Source/cmStack.tcc
Line | Count | Source |
1 | | /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
2 | | file LICENSE.rst or https://cmake.org/licensing for details. */ |
3 | | |
4 | | #include <cassert> |
5 | | #include <memory> |
6 | | #include <utility> |
7 | | |
8 | | template <typename T> |
9 | | struct cmStackEntry<T, cmStackType::Mutable> |
10 | | { |
11 | | cmStackEntry(std::shared_ptr<cmStackEntry const> parent, T value) |
12 | 0 | : Value(std::move(value)) |
13 | 0 | , Parent(std::move(parent)) |
14 | 0 | { |
15 | 0 | } |
16 | | |
17 | | T mutable Value; |
18 | | std::shared_ptr<cmStackEntry const> Parent; |
19 | | }; |
20 | | |
21 | | template <typename T> |
22 | | struct cmStackEntry<T, cmStackType::Const> |
23 | | { |
24 | | cmStackEntry(std::shared_ptr<cmStackEntry const> parent, T value) |
25 | 2 | : Value(std::move(value)) |
26 | 2 | , Parent(std::move(parent)) |
27 | 2 | { |
28 | 2 | } |
29 | | |
30 | | T Value; |
31 | | std::shared_ptr<cmStackEntry const> Parent; |
32 | | }; |
33 | | |
34 | | template <typename T, typename Stack, cmStackType Mutable> |
35 | 6 | cmStack<T, Stack, Mutable>::cmStack() = default; cmStack<cmListFileContext const, cmListFileBacktrace, (cmStackType)0>::cmStack() Line | Count | Source | 35 | 5 | cmStack<T, Stack, Mutable>::cmStack() = default; |
cmStack<cmFindPackageCall, cmFindPackageStack, (cmStackType)1>::cmStack() Line | Count | Source | 35 | 1 | cmStack<T, Stack, Mutable>::cmStack() = default; |
|
36 | | |
37 | | template <typename T, typename Stack, cmStackType Mutable> |
38 | | Stack cmStack<T, Stack, Mutable>::Push(T value) const |
39 | 2 | { |
40 | 2 | return Stack(this->TopEntry, std::move(value)); |
41 | 2 | } cmStack<cmListFileContext const, cmListFileBacktrace, (cmStackType)0>::Push(cmListFileContext) const Line | Count | Source | 39 | 2 | { | 40 | 2 | return Stack(this->TopEntry, std::move(value)); | 41 | 2 | } |
Unexecuted instantiation: cmStack<cmFindPackageCall, cmFindPackageStack, (cmStackType)1>::Push(cmFindPackageCall) const |
42 | | |
43 | | template <typename T, typename Stack, cmStackType Mutable> |
44 | | Stack cmStack<T, Stack, Mutable>::Pop() const |
45 | 3 | { |
46 | 3 | assert(this->TopEntry); |
47 | 3 | return Stack(this->TopEntry->Parent); |
48 | 3 | } cmStack<cmListFileContext const, cmListFileBacktrace, (cmStackType)0>::Pop() const Line | Count | Source | 45 | 3 | { | 46 | | assert(this->TopEntry); | 47 | 3 | return Stack(this->TopEntry->Parent); | 48 | 3 | } |
Unexecuted instantiation: cmStack<cmFindPackageCall, cmFindPackageStack, (cmStackType)1>::Pop() const |
49 | | |
50 | | template <typename T, typename Stack, cmStackType Mutable> |
51 | | T const& cmStack<T, Stack, Mutable>::Top() const |
52 | 5 | { |
53 | 5 | assert(this->TopEntry); |
54 | 5 | return this->TopEntry->Value; |
55 | 5 | } cmStack<cmListFileContext const, cmListFileBacktrace, (cmStackType)0>::Top() const Line | Count | Source | 52 | 5 | { | 53 | | assert(this->TopEntry); | 54 | 5 | return this->TopEntry->Value; | 55 | 5 | } |
Unexecuted instantiation: cmStack<cmFindPackageCall, cmFindPackageStack, (cmStackType)1>::Top() const |
56 | | |
57 | | template <typename T, typename Stack, cmStackType Mutable> |
58 | | template <bool E> |
59 | | typename std::enable_if<E, T>::type& cmStack<T, Stack, Mutable>::Top() |
60 | 0 | { |
61 | 0 | static_assert(Mutable == cmStackType::Mutable, |
62 | 0 | "T& cmStack::Top should only exist for mutable cmStack"); |
63 | 0 | assert(this->TopEntry); |
64 | 0 | return this->TopEntry->Value; |
65 | 0 | } |
66 | | |
67 | | template <typename T, typename Stack, cmStackType Mutable> |
68 | | bool cmStack<T, Stack, Mutable>::Empty() const |
69 | 7 | { |
70 | 7 | return !this->TopEntry; |
71 | 7 | } cmStack<cmListFileContext const, cmListFileBacktrace, (cmStackType)0>::Empty() const Line | Count | Source | 69 | 7 | { | 70 | 7 | return !this->TopEntry; | 71 | 7 | } |
Unexecuted instantiation: cmStack<cmFindPackageCall, cmFindPackageStack, (cmStackType)1>::Empty() const |
72 | | |
73 | | template <typename T, typename Stack, cmStackType Mutable> |
74 | | cmStack<T, Stack, Mutable>::cmStack(std::shared_ptr<Entry const> parent, |
75 | | T value) |
76 | | : TopEntry( |
77 | 2 | std::make_shared<Entry const>(std::move(parent), std::move(value))) |
78 | 2 | { |
79 | 2 | } cmStack<cmListFileContext const, cmListFileBacktrace, (cmStackType)0>::cmStack(std::__1::shared_ptr<cmStackEntry<cmListFileContext const, (cmStackType)0> const>, cmListFileContext) Line | Count | Source | 77 | 2 | std::make_shared<Entry const>(std::move(parent), std::move(value))) | 78 | 2 | { | 79 | 2 | } |
Unexecuted instantiation: cmStack<cmFindPackageCall, cmFindPackageStack, (cmStackType)1>::cmStack(std::__1::shared_ptr<cmStackEntry<cmFindPackageCall, (cmStackType)1> const>, cmFindPackageCall) |
80 | | |
81 | | template <typename T, typename Stack, cmStackType Mutable> |
82 | | cmStack<T, Stack, Mutable>::cmStack(std::shared_ptr<Entry const> top) |
83 | 3 | : TopEntry(std::move(top)) |
84 | 3 | { |
85 | 3 | } cmStack<cmListFileContext const, cmListFileBacktrace, (cmStackType)0>::cmStack(std::__1::shared_ptr<cmStackEntry<cmListFileContext const, (cmStackType)0> const>) Line | Count | Source | 83 | 3 | : TopEntry(std::move(top)) | 84 | 3 | { | 85 | 3 | } |
Unexecuted instantiation: cmStack<cmFindPackageCall, cmFindPackageStack, (cmStackType)1>::cmStack(std::__1::shared_ptr<cmStackEntry<cmFindPackageCall, (cmStackType)1> const>) |