[libc-commits] [libc] [libc][regex] Add ERE {m, n} interval quantifiers (PR #236569)

Alex Strelnikov via libc-commits libc-commits at lists.llvm.org
Tue Nov 17 07:46:02 PST 2026


================
@@ -330,14 +329,14 @@ ErrorOr<ExprId> ExprPool::make_concat(ExprId l, ExprId r) {
   if (r == EMPTY_STR_ID)
     return l;
   // (A · B) · C = A · (B · C) (Right-associative canonical form)
-  const Expr le = get(l);
+  const Expr &le = get(l);
----------------
strel-12 wrote:

I recall in regex_matcher.cpp, a line in `derivative` copied the result of `ExprPool::get`, to avoid dangling references from planned improvements since operations below that line mutated the pool.

This const-ref change (and probably some of the others) looks to create the same concern. Line 334 calls `make_concat` with `le.bin.right`, and line 337 references `le.bin.left`. Or do we not mind these in regex_expr_pool.cpp, because they will be easier to spot when follow-up changes are made?

If `Expr` will always stay 16 bytes, maybe we should change `get` to always return by value since `2*sizeof(void*)` types are generally recommended to be passed around by value?

https://github.com/llvm/llvm-project/pull/236569


More information about the libc-commits mailing list