[PATCH] D23829: [ELF] - Use std::regex instead of hand written logic in elf::globMatch()

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 31 12:10:53 PDT 2016

grimar added a comment.

In https://reviews.llvm.org/D23829#530634, @grimar wrote:

> In https://reviews.llvm.org/D23829#530626, @ruiu wrote:
> > How about defining a copy constructor to llvm::Regex and create mutable copies from const Regexs? Regex seems to be just two-pointer-sized object so copying it should be cheap.
> And wrap llvm_regex *preg into something like std::shared_ptr with custom deleter ?

I did not meant we should really do that, only that it is not that simple just to copy it properly.
Probably we can remove the set of error field from match() at all.

It has next code:

  if (rc != 0) {
    // regexec can fail due to invalid pattern or running out of memory.
    error = rc;
    return false;

I do not think that set a srror in case of invalid pattern is fine. As we might want to call it second time with valid one.
Out of memory probably is the error we can ignore.
Method anyways return bool result, that should be enough.


More information about the llvm-commits mailing list