1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-08 19:46:02 +01:00

parser.y: allocate Exprs in the allocator

This commit is contained in:
Taeer Bar-Yam 2025-11-04 21:20:19 +01:00
parent 948c89b367
commit b2f0472fe2

View file

@ -813,7 +813,7 @@ public:
[[gnu::always_inline]] [[gnu::always_inline]]
C * add(auto &&... args) C * add(auto &&... args)
{ {
return new C(std::forward<decltype(args)>(args)...); return alloc.new_object<C>(std::forward<decltype(args)>(args)...);
} }
// we define some calls to add explicitly so that the argument can be passed in as initializer lists // we define some calls to add explicitly so that the argument can be passed in as initializer lists
@ -822,7 +822,7 @@ public:
C * add(const PosIdx & pos, Expr * fun, std::vector<Expr *> && args) C * add(const PosIdx & pos, Expr * fun, std::vector<Expr *> && args)
requires(std::same_as<C, ExprCall>) requires(std::same_as<C, ExprCall>)
{ {
return new C(pos, fun, std::move(args)); return alloc.new_object<C>(pos, fun, std::move(args));
} }
template<class C> template<class C>
@ -830,7 +830,7 @@ public:
C * add(const PosIdx & pos, Expr * fun, std::vector<Expr *> && args, PosIdx && cursedOrEndPos) C * add(const PosIdx & pos, Expr * fun, std::vector<Expr *> && args, PosIdx && cursedOrEndPos)
requires(std::same_as<C, ExprCall>) requires(std::same_as<C, ExprCall>)
{ {
return new C(pos, fun, std::move(args), std::move(cursedOrEndPos)); return alloc.new_object<C>(pos, fun, std::move(args), std::move(cursedOrEndPos));
} }
template<class C> template<class C>