summaryrefslogtreecommitdiffstats
path: root/lldb/source/Symbol/ObjectFile.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-08-16 21:25:36 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-08-16 21:25:36 +0000
commit3af3f1e8e253d93cb655388af69f4ed1722b4f51 (patch)
tree44b9e8ecf404119a1a81b54e27ea6559a5f5dd9a /lldb/source/Symbol/ObjectFile.cpp
parent250aafa2c4a1bc2395edfe8d4365545bbe56fffe (diff)
downloadbcm5719-llvm-3af3f1e8e253d93cb655388af69f4ed1722b4f51.tar.gz
bcm5719-llvm-3af3f1e8e253d93cb655388af69f4ed1722b4f51.zip
[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
Diffstat (limited to 'lldb/source/Symbol/ObjectFile.cpp')
-rw-r--r--lldb/source/Symbol/ObjectFile.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp
index f0981a8cd12..4a897f2d367 100644
--- a/lldb/source/Symbol/ObjectFile.cpp
+++ b/lldb/source/Symbol/ObjectFile.cpp
@@ -575,18 +575,15 @@ bool ObjectFile::SplitArchivePathWithObject(const char *path_with_object,
FileSpec &archive_file,
ConstString &archive_object,
bool must_exist) {
+ llvm::SmallVector<llvm::StringRef, 3> matches;
RegularExpression g_object_regex(llvm::StringRef("(.*)\\(([^\\)]+)\\)$"));
- RegularExpression::Match regex_match(2);
if (g_object_regex.Execute(llvm::StringRef::withNullAsEmpty(path_with_object),
- &regex_match)) {
- std::string path;
- std::string obj;
- if (regex_match.GetMatchAtIndex(path_with_object, 1, path) &&
- regex_match.GetMatchAtIndex(path_with_object, 2, obj)) {
- archive_file.SetFile(path, FileSpec::Style::native);
- archive_object.SetCString(obj.c_str());
- return !(must_exist && !FileSystem::Instance().Exists(archive_file));
- }
+ &matches)) {
+ std::string path = matches[1].str();
+ std::string obj = matches[2].str();
+ archive_file.SetFile(path, FileSpec::Style::native);
+ archive_object.SetCString(obj.c_str());
+ return !(must_exist && !FileSystem::Instance().Exists(archive_file));
}
return false;
}
OpenPOWER on IntegriCloud