<rdar://problem/13384801>

Make lldb_private::RegularExpression thread safe everywhere. This was done by removing the m_matches array from the lldb_private::RegularExpression class and putting it into the new lldb_private::RegularExpression::Match class. When executing a regular expression you now have the option to create a lldb_private::RegularExpression::Match object and pass a pointer in if you want to get parenthesized matching. If you don't want any matching, you pass in NULL. The lldb_private::RegularExpression::Match object is initialized with the number of matches you desire. Any matching strings are now extracted from the lldb_private::RegularExpression::Match objects. This makes the regular expression objects thread safe and as a result many more regex objects were turned into static objects that end up using a local lldb_private::RegularExpression::Match object when executing.

llvm-svn: 178702
diff --git a/lldb/source/Symbol/Variable.cpp b/lldb/source/Symbol/Variable.cpp
index 309e392..3632eb8 100644
--- a/lldb/source/Symbol/Variable.cpp
+++ b/lldb/source/Symbol/Variable.cpp
@@ -396,11 +396,12 @@
             
         default:
             {
-                RegularExpression regex ("^([A-Za-z_:][A-Za-z_0-9:]*)(.*)");
-                if (regex.Execute(variable_expr_path, 1))
+                static RegularExpression g_regex ("^([A-Za-z_:][A-Za-z_0-9:]*)(.*)");
+                RegularExpression::Match regex_match(1);
+                if (g_regex.Execute(variable_expr_path, &regex_match))
                 {
                     std::string variable_name;
-                    if (regex.GetMatchAtIndex(variable_expr_path, 1, variable_name))
+                    if (regex_match.GetMatchAtIndex(variable_expr_path, 1, variable_name))
                     {
                         variable_list.Clear();
                         if (callback (baton, variable_name.c_str(), variable_list))