[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 10:04:04 PDT 2016


grimar added a comment.

In https://reviews.llvm.org/D23829#530459, @ruiu wrote:

> llvm::Regex is not used in that many places, so it seems you can make `Match` const and update all places where that member function is called.


Actually it is. Just search "Regex" in llvm. I wanted to do it const here: https://reviews.llvm.org/D24027. It requires making error field to be mutable.

David Blaikie was against this change:

> "Sounds like the error handling is part of the identity of the object - I'm not sure it'd be a good idea to make that mutable & make the object logically const when it's actually changing that error field. (it seems it'd be easy to introduce misuse there - where one user does something to the Regex, then passes a const ref somewhere, then examines the error field and finds it changed - let alone multithreading)"


His suggestion was:

> "(or remove the side-channel error handling, and have the APIs return errors explicitly instead - the side channel's likely to be accidentally unchecked by many callers, which is probably a mistake)"


Reworking llvm::Regex API is not a little change and I am not sure it is worth that as std::regex is a part of c++ 11 and I hope soon all compilers will have a support.


https://reviews.llvm.org/D23829





More information about the llvm-commits mailing list