<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.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@178702 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Symbol/ObjectFile.cpp b/source/Symbol/ObjectFile.cpp
index 5451f69..1187e79 100644
--- a/source/Symbol/ObjectFile.cpp
+++ b/source/Symbol/ObjectFile.cpp
@@ -517,12 +517,13 @@
ObjectFile::SplitArchivePathWithObject (const char *path_with_object, FileSpec &archive_file, ConstString &archive_object, bool must_exist)
{
RegularExpression g_object_regex("(.*)\\(([^\\)]+)\\)$");
- if (g_object_regex.Execute (path_with_object, 2))
+ RegularExpression::Match regex_match(2);
+ if (g_object_regex.Execute (path_with_object, ®ex_match))
{
std::string path;
std::string obj;
- if (g_object_regex.GetMatchAtIndex (path_with_object, 1, path) &&
- g_object_regex.GetMatchAtIndex (path_with_object, 2, obj))
+ if (regex_match.GetMatchAtIndex (path_with_object, 1, path) &&
+ regex_match.GetMatchAtIndex (path_with_object, 2, obj))
{
archive_file.SetFile (path.c_str(), false);
archive_object.SetCString(obj.c_str());