summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.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/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.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/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp')
-rw-r--r--lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
index f45c9b74721..2e0c8d52ddd 100644
--- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
@@ -443,27 +443,28 @@ bool ParseCoordinate(llvm::StringRef coord_s, RSCoordinate &coord) {
// returned, `true` otherwise
RegularExpression regex;
- RegularExpression::Match regex_match(3);
+ llvm::SmallVector<llvm::StringRef, 4> matches;
bool matched = false;
if (regex.Compile(llvm::StringRef("^([0-9]+),([0-9]+),([0-9]+)$")) &&
- regex.Execute(coord_s, &regex_match))
+ regex.Execute(coord_s, &matches))
matched = true;
else if (regex.Compile(llvm::StringRef("^([0-9]+),([0-9]+)$")) &&
- regex.Execute(coord_s, &regex_match))
+ regex.Execute(coord_s, &matches))
matched = true;
else if (regex.Compile(llvm::StringRef("^([0-9]+)$")) &&
- regex.Execute(coord_s, &regex_match))
+ regex.Execute(coord_s, &matches))
matched = true;
if (!matched)
return false;
- auto get_index = [&](int idx, uint32_t &i) -> bool {
+ auto get_index = [&](size_t idx, uint32_t &i) -> bool {
std::string group;
errno = 0;
- if (regex_match.GetMatchAtIndex(coord_s.str().c_str(), idx + 1, group))
- return !llvm::StringRef(group).getAsInteger<uint32_t>(10, i);
+ if (idx + 1 < matches.size()) {
+ return !llvm::StringRef(matches[idx + 1]).getAsInteger<uint32_t>(10, i);
+ }
return true;
};
@@ -4147,13 +4148,12 @@ public:
// Matching a comma separated list of known words is fairly
// straightforward with PCRE, but we're using ERE, so we end up with a
// little ugliness...
- RegularExpression::Match match(/* max_matches */ 5);
RegularExpression match_type_list(
llvm::StringRef("^([[:alpha:]]+)(,[[:alpha:]]+){0,4}$"));
assert(match_type_list.IsValid());
- if (!match_type_list.Execute(option_val, &match)) {
+ if (!match_type_list.Execute(option_val)) {
err_str.PutCString(
"a comma-separated list of kernel types is required");
return false;
OpenPOWER on IntegriCloud