Skip to content

Commit d596b97

Browse files
authored
Merge pull request NixOS#14472 from Radvendii/exprs-alloc
libexpr: allocate the Exprs themselves in Exprs::alloc
2 parents 3f18cad + b2f0472 commit d596b97

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/libexpr/include/nix/expr/nixexpr.hh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ public:
813813
[[gnu::always_inline]]
814814
C * add(auto &&... args)
815815
{
816-
return new C(std::forward<decltype(args)>(args)...);
816+
return alloc.new_object<C>(std::forward<decltype(args)>(args)...);
817817
}
818818

819819
// we define some calls to add explicitly so that the argument can be passed in as initializer lists
@@ -822,15 +822,15 @@ public:
822822
C * add(const PosIdx & pos, Expr * fun, std::vector<Expr *> && args)
823823
requires(std::same_as<C, ExprCall>)
824824
{
825-
return new C(pos, fun, std::move(args));
825+
return alloc.new_object<C>(pos, fun, std::move(args));
826826
}
827827

828828
template<class C>
829829
[[gnu::always_inline]]
830830
C * add(const PosIdx & pos, Expr * fun, std::vector<Expr *> && args, PosIdx && cursedOrEndPos)
831831
requires(std::same_as<C, ExprCall>)
832832
{
833-
return new C(pos, fun, std::move(args), std::move(cursedOrEndPos));
833+
return alloc.new_object<C>(pos, fun, std::move(args), std::move(cursedOrEndPos));
834834
}
835835

836836
template<class C>

0 commit comments

Comments
 (0)