[libc-commits] [libc] [libc][regex] Wire regex entrypoints to ExprPool matcher (PR #232291)

Jeff Bailey via libc-commits libc-commits at lists.llvm.org
Fri Oct 16 07:57:42 PDT 2026


================
@@ -69,23 +69,49 @@ TEST(LlvmLibcRegexExprTest, RecursiveInterning) {
 TEST(LlvmLibcRegexExprTest, AlgebraicIdentitiesConcat) {
   ExprPool pool;
   auto lit_a = pool.make_lit('a').value();
+  auto lit_b = pool.make_lit('b').value();
   auto empty_set = pool.empty_set().value();
   auto empty_str = pool.empty_str().value();
 
+  // Invalid IDs return REG_BADPAT.
+  EXPECT_EQ(pool.make_concat(INVALID_EXPR_ID, lit_a).error(), REG_BADPAT);
----------------
kaladron wrote:

> I suppose this is for follow-ups given existing usage, but these unit tests do a lot of calling `.value()` and `.error()` without checking `has_value()` in the majority of cases, which could get annoying to root-cause if something fails.
> 
> We should really add some matchers like `HasValue(inner_matcher)` and `IsError(inner_matcher)`.

I hadn't been so worried in the tests (since they would fail), but it's good to do it right.

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


More information about the libc-commits mailing list