[lldb] D66174 RegularExpression cleanup

I find as a good cleanup to drop the Compile method. As I do not find TIMTOWTDI
as an advantage and there is already constructor parameter to compile the
regex.

Differential Revision: https://reviews.llvm.org/D66392

llvm-svn: 369352
This commit is contained in:
Jan Kratochvil
2019-08-20 09:24:20 +00:00
parent 12d83b4270
commit f9d90bc5f6
14 changed files with 61 additions and 71 deletions

View File

@@ -442,21 +442,12 @@ bool ParseCoordinate(llvm::StringRef coord_s, RSCoordinate &coord) {
// elements fails the contents of &coord are undefined and `false` is
// returned, `true` otherwise
RegularExpression regex;
llvm::SmallVector<llvm::StringRef, 4> matches;
bool matched = false;
if (regex.Compile(llvm::StringRef("^([0-9]+),([0-9]+),([0-9]+)$")) &&
regex.Execute(coord_s, &matches))
matched = true;
else if (regex.Compile(llvm::StringRef("^([0-9]+),([0-9]+)$")) &&
regex.Execute(coord_s, &matches))
matched = true;
else if (regex.Compile(llvm::StringRef("^([0-9]+)$")) &&
regex.Execute(coord_s, &matches))
matched = true;
if (!matched)
if (!RegularExpression("^([0-9]+),([0-9]+),([0-9]+)$")
.Execute(coord_s, &matches) &&
!RegularExpression("^([0-9]+),([0-9]+)$").Execute(coord_s, &matches) &&
!RegularExpression("^([0-9]+)$").Execute(coord_s, &matches))
return false;
auto get_index = [&](size_t idx, uint32_t &i) -> bool {