1 //===-- NameMatches.cpp -----------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
9 #include "lldb/Utility/NameMatches.h"
10 #include "lldb/Utility/RegularExpression.h"
12 #include "llvm/ADT/StringRef.h"
14 using namespace lldb_private;
16 bool lldb_private::NameMatches(llvm::StringRef name, NameMatch match_type,
17 llvm::StringRef match) {
19 case NameMatch::Ignore:
21 case NameMatch::Equals:
23 case NameMatch::Contains:
24 return name.contains(match);
25 case NameMatch::StartsWith:
26 return name.startswith(match);
27 case NameMatch::EndsWith:
28 return name.endswith(match);
29 case NameMatch::RegularExpression: {
30 RegularExpression regex(match);
31 return regex.Execute(name);