LLDB
mainline
llvm-project
lldb
source
Utility
NameMatches.cpp
Go to the documentation of this file.
1
//===-- NameMatches.cpp ---------------------------------------------------===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
#include "
lldb/Utility/NameMatches.h
"
9
#include "
lldb/Utility/RegularExpression.h
"
10
11
#include "llvm/ADT/StringRef.h"
12
13
using namespace
lldb_private
;
14
15
bool
lldb_private::NameMatches
(llvm::StringRef name,
NameMatch
match_type,
16
llvm::StringRef match) {
17
switch
(match_type) {
18
case
NameMatch::Ignore
:
19
return
true
;
20
case
NameMatch::Equals
:
21
return
name == match;
22
case
NameMatch::Contains
:
23
return
name.contains(match);
24
case
NameMatch::StartsWith
:
25
return
name.starts_with(match);
26
case
NameMatch::EndsWith
:
27
return
name.ends_with(match);
28
case
NameMatch::RegularExpression
: {
29
RegularExpression
regex(match);
30
return
regex.
Execute
(name);
31
}
32
}
33
return
false
;
34
}
NameMatches.h
RegularExpression.h
lldb_private::RegularExpression
Definition
RegularExpression.h:18
lldb_private::RegularExpression::Execute
bool Execute(llvm::StringRef string, llvm::SmallVectorImpl< llvm::StringRef > *matches=nullptr) const
Execute a regular expression match using the compiled regular expression that is already in this obje...
Definition
RegularExpression.cpp:24
lldb_private
A class that represents a running process on the host machine.
Definition
SBAddressRange.h:14
lldb_private::NameMatch
NameMatch
Definition
NameMatches.h:15
lldb_private::NameMatch::Equals
@ Equals
Definition
NameMatches.h:17
lldb_private::NameMatch::EndsWith
@ EndsWith
Definition
NameMatches.h:20
lldb_private::NameMatch::StartsWith
@ StartsWith
Definition
NameMatches.h:19
lldb_private::NameMatch::Contains
@ Contains
Definition
NameMatches.h:18
lldb_private::NameMatch::RegularExpression
@ RegularExpression
Definition
NameMatches.h:21
lldb_private::NameMatch::Ignore
@ Ignore
Definition
NameMatches.h:16
lldb_private::NameMatches
bool NameMatches(llvm::StringRef name, NameMatch match_type, llvm::StringRef match)
Definition
NameMatches.cpp:15
Generated on
for LLDB by
1.14.0