diff options
Diffstat (limited to 'third_party/nix/src/libexpr')
-rw-r--r-- | third_party/nix/src/libexpr/eval.cc | 7 | ||||
-rw-r--r-- | third_party/nix/src/libexpr/nixexpr.hh | 1 | ||||
-rw-r--r-- | third_party/nix/src/libexpr/value.hh | 2 |
3 files changed, 10 insertions, 0 deletions
diff --git a/third_party/nix/src/libexpr/eval.cc b/third_party/nix/src/libexpr/eval.cc index 2b825bfd2788..0f3b7fabe029 100644 --- a/third_party/nix/src/libexpr/eval.cc +++ b/third_party/nix/src/libexpr/eval.cc @@ -5,10 +5,13 @@ #include <cstring> #include <fstream> #include <iostream> +#include <memory> #include <new> #include <optional> #include <variant> +#define GC_INCLUDE_NEW + #include <absl/strings/match.h> #include <gc/gc.h> #include <gc/gc_cpp.h> @@ -40,6 +43,10 @@ static char* dupString(const char* s) { return t; } +std::shared_ptr<Value*> allocRootValue(Value* v) { + return std::allocate_shared<Value*>(traceable_allocator<Value*>(), v); +} + static void printValue(std::ostream& str, std::set<const Value*>& active, const Value& v) { checkInterrupt(); diff --git a/third_party/nix/src/libexpr/nixexpr.hh b/third_party/nix/src/libexpr/nixexpr.hh index 4b2bd86ef966..365235377f71 100644 --- a/third_party/nix/src/libexpr/nixexpr.hh +++ b/third_party/nix/src/libexpr/nixexpr.hh @@ -3,6 +3,7 @@ #include <map> #include <optional> #include <variant> + #include <absl/container/flat_hash_map.h> #include "libexpr/symbol-table.hh" diff --git a/third_party/nix/src/libexpr/value.hh b/third_party/nix/src/libexpr/value.hh index 7308dd31933a..cb1b8796cfe4 100644 --- a/third_party/nix/src/libexpr/value.hh +++ b/third_party/nix/src/libexpr/value.hh @@ -247,4 +247,6 @@ typedef std::map<Symbol, Value*, std::less<Symbol>, traceable_allocator<std::pair<const Symbol, Value*>>> ValueMap; +std::shared_ptr<Value*> allocRootValue(Value* v); + } // namespace nix |