fix(3p/nix/libexpr): Use gc_allocator<T> as the btree_map allocator

This will make all Attr values visible to the GC.
This commit is contained in:
Vincent Ambo 2020-05-22 23:43:44 +01:00
parent 5f728cb428
commit 8c28be1b69

View file

@ -2,10 +2,11 @@
#pragma once
#include <absl/container/btree_map.h>
#include <gc/gc_allocator.h>
#include "nixexpr.hh"
#include "symbol-table.hh"
#include "types.hh" // TODO(tazjin): audit this include
#include "types.hh"
namespace nix { // TODO(tazjin): ::expr
@ -29,6 +30,12 @@ inline bool operator==(const Attr& lhs, const Attr& rhs) {
return lhs.name == rhs.name;
}
// Convenience alias for the backing map, with the garbage-collecting
// allocator explicitly specified.
using AttributeMap =
absl::btree_map<Symbol, Attr, std::less<Symbol>,
gc_allocator<std::pair<const Symbol, Attr>>>;
class Bindings {
public:
typedef absl::btree_map<Symbol, Attr>::iterator iterator;