<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/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp
index 3d4b7ffd..2a67f1d 100644
--- a/lldb/source/Core/Disassembler.cpp
+++ b/lldb/source/Core/Disassembler.cpp
@@ -684,10 +684,11 @@
         if (line.size() > 0)
         {
             std::string value;
-            RegularExpression reg_exp ("^[ \t]*([^ \t]+)[ \t]*$");
-            bool reg_exp_success = reg_exp.Execute (line.c_str(), 1);
+            static RegularExpression g_reg_exp ("^[ \t]*([^ \t]+)[ \t]*$");
+            RegularExpression::Match regex_match(1);
+            bool reg_exp_success = g_reg_exp.Execute (line.c_str(), &regex_match);
             if (reg_exp_success)
-                reg_exp.GetMatchAtIndex (line.c_str(), 1, value);
+                regex_match.GetMatchAtIndex (line.c_str(), 1, value);
             else
                 value = line;
                 
@@ -752,14 +753,16 @@
         // Try to find a key-value pair in the current line and add it to the dictionary.
         if (line.size() > 0)
         {
-            RegularExpression reg_exp ("^[ \t]*([a-zA-Z_][a-zA-Z0-9_]*)[ \t]*=[ \t]*(.*)[ \t]*$");
-            bool reg_exp_success = reg_exp.Execute (line.c_str(), 2);
+            static RegularExpression g_reg_exp ("^[ \t]*([a-zA-Z_][a-zA-Z0-9_]*)[ \t]*=[ \t]*(.*)[ \t]*$");
+            RegularExpression::Match regex_match(2);
+
+            bool reg_exp_success = g_reg_exp.Execute (line.c_str(), &regex_match);
             std::string key;
             std::string value;
             if (reg_exp_success)
             {
-                reg_exp.GetMatchAtIndex (line.c_str(), 1, key);
-                reg_exp.GetMatchAtIndex (line.c_str(), 2, value);
+                regex_match.GetMatchAtIndex (line.c_str(), 1, key);
+                regex_match.GetMatchAtIndex (line.c_str(), 2, value);
             }
             else 
             {