Currently, if llvm::Regex is constructed with an invalid pattern, it only
exposes this fact if the call site checks isValid(). The Regex class itself also
statefully maintains a (mutable) error code internally, which means its match()
function is not const.
This change adds a "fallible constructor" to llvm::Regex:
http://llvm.org/docs/ProgrammersManual.html#fallible-constructors
and then plumbs it through LLVM code. (Follow-up changes are prepared to update
uses in Clang.)
I plan to expand RegexError to handle the error values directly (see regerror.c)
and return it from match(), which will remove the last of the error state from
Regex, allowing match() to become const. Right away, though, this change deletes
the last vestiges of stateful error codes from the internal regex implementation
(regexec.c). This allows constructing cheap errors that require only the code,
and do not need to refer to the compiled regex. These error cases (REG_ATOI and
REG_ITOA) never happen in LLVM code, and are not POSIX-standard.
No need for braces IMO.