[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
This commit is contained in:
Jonas Devlieghere
2019-08-16 21:25:36 +00:00
parent 250aafa2c4
commit 3af3f1e8e2
28 changed files with 272 additions and 465 deletions

View File

@@ -361,26 +361,17 @@ bool ThreadPlanStepInRange::FrameMatchesAvoidCriteria() {
sc.GetFunctionName(Mangled::ePreferDemangledWithoutArguments)
.GetCString();
if (frame_function_name) {
size_t num_matches = 0;
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
if (log)
num_matches = 1;
RegularExpression::Match regex_match(num_matches);
llvm::SmallVector<llvm::StringRef, 2> matches;
bool return_value =
avoid_regexp_to_use->Execute(frame_function_name, &regex_match);
if (return_value) {
if (log) {
std::string match;
regex_match.GetMatchAtIndex(frame_function_name, 0, match);
LLDB_LOGF(log,
"Stepping out of function \"%s\" because it matches "
"the avoid regexp \"%s\" - match substring: \"%s\".",
frame_function_name,
avoid_regexp_to_use->GetText().str().c_str(),
match.c_str());
}
avoid_regexp_to_use->Execute(frame_function_name, &matches);
if (return_value && matches.size() > 1) {
std::string match = matches[1].str();
LLDB_LOGF(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP),
"Stepping out of function \"%s\" because it matches "
"the avoid regexp \"%s\" - match substring: \"%s\".",
frame_function_name,
avoid_regexp_to_use->GetText().str().c_str(),
match.c_str());
}
return return_value;
}