[llvm] [Support][NFC] Add test documenting that empty `Regex` pattern matches nothing. (PR #83849)

via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 5 03:34:11 PST 2024


martinboehme wrote:

> if this is different from other regex implementations, could we make it do something more like other implementations so as to be less surprising? (is this a feature of the underlying regex library we use - or something we added on top?)

I don't see anything in Regex.cpp that special-cases this, so I assume it's a feature of the libc regex code.

> Couldn't find clear documentation in the libc regex (at a glance/quick googling) that this is all based on - but doesn't look like we special case it in any way, so probably a feature of libc's regex...

Agree.

I have to admit I'm not sure why we do this, or why the libc regex does it -- but I have to assume that _some_ user of `Regex` relies on this behavior (knowingly or unknowingly), so I'm hesitant to change it. I did, however, at least want to get a test in documenting the behavior.

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


More information about the llvm-commits mailing list