Page MenuHomePhabricator

Fix a couple of corner cases in NameMatches
ClosedPublic

Authored by labath on Feb 17 2017, 7:24 AM.

Details

Summary

I originally set out to move the NameMatches closer to the relevant
function and add some unit tests. However, in the process I've found a
couple of bugs in the implementation:

  • the early exits where not always correct:
    • (test==pattern) does not mean the match will always suceed because of regular expressions
    • pattern.empty() does not mean the match will fail because the "" is a valid prefix of any string

So I cleaned up those and added some tests. The only tricky part here
was that regcomp() implementation on darwin did not recognise the empty
string as a regular expression and returned an REG_EMPTY error instead.
The simples fix here seemed to be to replace the empty expression with
an equivalent non-empty one.

Diff Detail

Repository
rL LLVM

Event Timeline

labath created this revision.Feb 17 2017, 7:24 AM
clayborg accepted this revision.Feb 17 2017, 9:02 AM
This revision is now accepted and ready to land.Feb 17 2017, 9:02 AM
This revision was automatically updated to reflect the committed changes.