From 205afe679855a4ce8149cdaa94d3f0868ce796dc Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Fri, 6 Feb 2015 21:38:51 +0000 Subject: Import LLDB as of upstream SVN r225923 (git 2b588ecd) This corresponds with the branchpoint for the 3.6 release. A number of files not required for the FreeBSD build have been removed. Sponsored by: DARPA, AFRL --- source/Core/RegularExpression.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'source/Core/RegularExpression.cpp') diff --git a/source/Core/RegularExpression.cpp b/source/Core/RegularExpression.cpp index 88415f616828..54924d069537 100644 --- a/source/Core/RegularExpression.cpp +++ b/source/Core/RegularExpression.cpp @@ -162,20 +162,11 @@ RegularExpression::Execute(const char* s, Match *match, int execute_flags) const bool RegularExpression::Match::GetMatchAtIndex (const char* s, uint32_t idx, std::string& match_str) const { - if (idx < m_matches.size()) + llvm::StringRef match_str_ref; + if (GetMatchAtIndex(s, idx, match_str_ref)) { - if (m_matches[idx].rm_eo == m_matches[idx].rm_so) - { - // Matched the empty string... - match_str.clear(); - return true; - } - else if (m_matches[idx].rm_eo > m_matches[idx].rm_so) - { - match_str.assign (s + m_matches[idx].rm_so, - m_matches[idx].rm_eo - m_matches[idx].rm_so); - return true; - } + match_str = std::move(match_str_ref.str()); + return true; } return false; } @@ -185,6 +176,9 @@ RegularExpression::Match::GetMatchAtIndex (const char* s, uint32_t idx, llvm::St { if (idx < m_matches.size()) { + if (m_matches[idx].rm_eo == -1 && m_matches[idx].rm_so == -1) + return false; + if (m_matches[idx].rm_eo == m_matches[idx].rm_so) { // Matched the empty string... -- cgit v1.2.3