diff options
Diffstat (limited to 'source/Utility/NameMatches.cpp')
| -rw-r--r-- | source/Utility/NameMatches.cpp | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/source/Utility/NameMatches.cpp b/source/Utility/NameMatches.cpp index 7b733d24eba2..a76df3f929e8 100644 --- a/source/Utility/NameMatches.cpp +++ b/source/Utility/NameMatches.cpp @@ -7,38 +7,29 @@ // //===----------------------------------------------------------------------===// #include "lldb/Utility/NameMatches.h" -#include "lldb/Core/RegularExpression.h" +#include "lldb/Utility/RegularExpression.h" #include "llvm/ADT/StringRef.h" using namespace lldb_private; -bool lldb_private::NameMatches(llvm::StringRef name, NameMatchType match_type, +bool lldb_private::NameMatches(llvm::StringRef name, NameMatch match_type, llvm::StringRef match) { - if (match_type == eNameMatchIgnore) - return true; - - if (name == match) - return true; - - if (name.empty() || match.empty()) - return false; - switch (match_type) { - case eNameMatchIgnore: // This case cannot occur: tested before + case NameMatch::Ignore: return true; - case eNameMatchEquals: + case NameMatch::Equals: return name == match; - case eNameMatchContains: + case NameMatch::Contains: return name.contains(match); - case eNameMatchStartsWith: + case NameMatch::StartsWith: return name.startswith(match); - case eNameMatchEndsWith: + case NameMatch::EndsWith: return name.endswith(match); - case eNameMatchRegularExpression: { + case NameMatch::RegularExpression: { RegularExpression regex(match); return regex.Execute(name); - } break; + } } return false; } |
