Regex: Add isValid() with no parameter
authorJan Kratochvil <jan.kratochvil@redhat.com>
Tue, 20 Aug 2019 16:05:23 +0000 (16:05 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Tue, 20 Aug 2019 16:05:23 +0000 (16:05 +0000)
There will be some performance (only a little) improvement for LLDB's
RegularExpression::Execute.

Differential Revision: https://reviews.llvm.org/D66463

llvm-svn: 369396

llvm/include/llvm/Support/Regex.h

index b05349d..ca5e8cd 100644 (file)
@@ -60,6 +60,7 @@ namespace llvm {
     /// isValid - returns the error encountered during regex compilation, or
     /// matching, if any.
     bool isValid(std::string &Error) const;
+    bool isValid() const { return !error; }
 
     /// getNumMatches - In a valid regex, return the number of parenthesized
     /// matches it contains.  The number filled in by match will include this