Skip to content

Commit 614e143

Browse files
committed
libexpr: switch ExprAttrs to std::pmr::{vector,map}
1 parent 77982c5 commit 614e143

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,9 +395,9 @@ struct ExprAttrs : Expr
395395
}
396396
};
397397

398-
typedef std::map<Symbol, AttrDef> AttrDefs;
398+
typedef std::pmr::map<Symbol, AttrDef> AttrDefs;
399399
AttrDefs attrs;
400-
std::unique_ptr<std::vector<Expr *>> inheritFromExprs;
400+
std::unique_ptr<std::pmr::vector<Expr *>> inheritFromExprs;
401401

402402
struct DynamicAttrDef
403403
{
@@ -409,7 +409,7 @@ struct ExprAttrs : Expr
409409
, pos(pos) {};
410410
};
411411

412-
typedef std::vector<DynamicAttrDef> DynamicAttrDefs;
412+
typedef std::pmr::vector<DynamicAttrDef> DynamicAttrDefs;
413413
DynamicAttrDefs dynamicAttrs;
414414
ExprAttrs(const PosIdx & pos)
415415
: recursive(false)

src/libexpr/include/nix/expr/parser-state.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ ParserState::addAttr(ExprAttrs * attrs, AttrPath & attrPath, const Symbol & symb
181181
// See https://github.com/NixOS/nix/issues/9020.
182182
if (jAttrs && ae) {
183183
if (ae->inheritFromExprs && !jAttrs->inheritFromExprs)
184-
jAttrs->inheritFromExprs = std::make_unique<std::vector<Expr *>>();
184+
jAttrs->inheritFromExprs = std::make_unique<std::pmr::vector<Expr *>>();
185185
for (auto & ad : ae->attrs) {
186186
if (ad.second.kind == ExprAttrs::AttrDef::Kind::InheritedFrom) {
187187
auto & sel = dynamic_cast<ExprSelect &>(*ad.second.e);

src/libexpr/parser.y

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ binds1
423423
| binds[accum] INHERIT '(' expr ')' attrs ';'
424424
{ $$ = $accum;
425425
if (!$accum->inheritFromExprs)
426-
$accum->inheritFromExprs = std::make_unique<std::vector<Expr *>>();
426+
$accum->inheritFromExprs = std::make_unique<std::pmr::vector<Expr *>>();
427427
$accum->inheritFromExprs->push_back($expr);
428428
auto from = state->exprs.add<ExprInheritFrom>(state->at(@expr), $accum->inheritFromExprs->size() - 1);
429429
for (auto & [i, iPos] : $attrs) {

0 commit comments

Comments
 (0)