llvm-project
88057eaf - [libc][NFC] Clean up regex tables, headers, and CMake deps (#243759)

Commit
3 days ago
[libc][NFC] Clean up regex tables, headers, and CMake deps (#243759) Integer-only baremetal targets cannot rely on floating-point helpers just to size a hash table, and PIE builds should keep constant lookup tables in shared read-only memory rather than dirtying copy-on-write .data.rel.ro pages with dynamic relocations at startup. In addition, subarchive builds linking regcomp or regexec without regfree miss operator delete because collect_object_file_deps skips header libraries, and POSIX requires <regex.h> to export size_t directly. Switch ExprPool::max_hashtable_nodes() to integer 7/10 arithmetic and store inline class names in pure .rodata tables behind a [[nodiscard]] add_posix_class helper, avoiding both 32-byte copies and raw nullable pointers while shrinking regex_parser.cpp.o by 725 bytes at -O2 and 775 bytes at -Os with zero relocations. Export size_t in regex.yaml, add direct libc.src.__support.CPP.new dependencies, clear preg before delete so teardown never exposes a dangling pointer, and tighten internal assert and static_assert guards. Compliance: Henry Spencer spencer_tests.txt 268/456 Bool/Err (+0) and 84/456 Full Pos (+0); AT&T testregex 399/400 ERE Bool/Err (+0), 401/473 All Bool/Err (+0), and 18/465 Full Pos (+0); zero regressions. Assisted-by: Automated tooling, human reviewed.
Author
Parents
Loading