[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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user