[Utility] Reimplement RegularExpression on top of llvm::Regex

Originally I wanted to remove the RegularExpression class in Utility and
replace it with llvm::Regex. However, during that transition I noticed
that there are several places where need the regular expression string.
So instead I propose to keep the RegularExpression class and make it a
thin wrapper around llvm::Regex.

This patch also removes the workaround for empty regular expressions.
The result is that we are now (more or less) POSIX conformant.

Differential revision: https://reviews.llvm.org/D66174

llvm-svn: 369153
diff --git a/lldb/source/Target/ThreadPlanStepInRange.cpp b/lldb/source/Target/ThreadPlanStepInRange.cpp
index ff6553e..a0549c8 100644
--- a/lldb/source/Target/ThreadPlanStepInRange.cpp
+++ b/lldb/source/Target/ThreadPlanStepInRange.cpp
@@ -361,26 +361,17 @@
           sc.GetFunctionName(Mangled::ePreferDemangledWithoutArguments)
               .GetCString();
       if (frame_function_name) {
-        size_t num_matches = 0;
-        Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
-        if (log)
-          num_matches = 1;
-
-        RegularExpression::Match regex_match(num_matches);
-
+        llvm::SmallVector<llvm::StringRef, 2> matches;
         bool return_value =
-            avoid_regexp_to_use->Execute(frame_function_name, &regex_match);
-        if (return_value) {
-          if (log) {
-            std::string match;
-            regex_match.GetMatchAtIndex(frame_function_name, 0, match);
-            LLDB_LOGF(log,
-                      "Stepping out of function \"%s\" because it matches "
-                      "the avoid regexp \"%s\" - match substring: \"%s\".",
-                      frame_function_name,
-                      avoid_regexp_to_use->GetText().str().c_str(),
-                      match.c_str());
-          }
+            avoid_regexp_to_use->Execute(frame_function_name, &matches);
+        if (return_value && matches.size() > 1) {
+          std::string match = matches[1].str();
+          LLDB_LOGF(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP),
+                    "Stepping out of function \"%s\" because it matches "
+                    "the avoid regexp \"%s\" - match substring: \"%s\".",
+                    frame_function_name,
+                    avoid_regexp_to_use->GetText().str().c_str(),
+                    match.c_str());
         }
         return return_value;
       }