This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Treat trailing backslashes in a regex pattern as invalid.
ClosedPublic

Authored by jpetrie on Jan 16 2016, 2:42 PM.

Details

Reviewers
mclow.lists
Summary

std::regex should throw std::regex_error if constructed with a pattern ending in a trailing backslash, since a trailing backlash is not a valid escape sequence.

This addresses bug #26175.

Diff Detail

Event Timeline

jpetrie updated this revision to Diff 45082.Jan 16 2016, 2:42 PM
jpetrie retitled this revision from to [libc++] Treat trailing backslashes in a regex pattern as invalid..
jpetrie updated this object.
jpetrie added a reviewer: mclow.lists.
jpetrie updated this object.
jpetrie added a subscriber: cfe-commits.
mclow.lists accepted this revision.Jan 18 2016, 6:55 AM
mclow.lists edited edge metadata.

This looks good to me. A quick search for \\ in regex didn't find any other obvious instances of this anti-pattern. For the record, the bug is https://llvm.org/bugs/show_bug.cgi?id=26175

Can you commit this yourself, or would you rather I did it?

This revision is now accepted and ready to land.Jan 18 2016, 6:55 AM

This looks good to me. A quick search for \\ in regex didn't find any other obvious instances of this anti-pattern. For the record, the bug is https://llvm.org/bugs/show_bug.cgi?id=26175

Can you commit this yourself, or would you rather I did it?

I don't have commit access; if you could commit it, that would be great.

Eugene.Zelenko added a subscriber: Eugene.Zelenko.

Committed in r258107.