LLDB  mainline
Public Member Functions | Private Attributes | List of all members
lldb_private::RegularExpression Class Reference

#include <RegularExpression.h>

Collaboration diagram for lldb_private::RegularExpression:
Collaboration graph
[legend]

Public Member Functions

 RegularExpression ()=default
 The default constructor that initializes the object state such that it contains no compiled regular expression. More...
 
 RegularExpression (llvm::StringRef string)
 Constructor for a regular expression. More...
 
 ~RegularExpression ()=default
 
 RegularExpression (const RegularExpression &rhs)
 
 RegularExpression (RegularExpression &&rhs)=default
 
RegularExpressionoperator= (RegularExpression &&rhs)=default
 
RegularExpressionoperator= (const RegularExpression &rhs)=default
 
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 object against the given string. More...
 
llvm::StringRef GetText () const
 Access the regular expression text. More...
 
bool IsValid () const
 Test if this object contains a valid regular expression. More...
 
llvm::Error GetError () const
 Return an error if the regular expression failed to compile. More...
 
bool operator== (const RegularExpression &rhs) const
 

Private Attributes

std::string m_regex_text
 A copy of the original regular expression text. More...
 
llvm::Regex m_regex
 The compiled regular expression. More...
 

Detailed Description

Definition at line 18 of file RegularExpression.h.

Constructor & Destructor Documentation

◆ RegularExpression() [1/4]

lldb_private::RegularExpression::RegularExpression ( )
default

The default constructor that initializes the object state such that it contains no compiled regular expression.

◆ RegularExpression() [2/4]

RegularExpression::RegularExpression ( llvm::StringRef  string)
explicit

Constructor for a regular expression.

Compile a regular expression using the supplied regular expression text. The compiled regular expression lives in this object so that it can be readily used for regular expression matches. Execute() can be called after the regular expression is compiled.

Parameters
[in]stringAn llvm::StringRef that represents the regular expression to compile.

Definition at line 15 of file RegularExpression.cpp.

◆ ~RegularExpression()

lldb_private::RegularExpression::~RegularExpression ( )
default

◆ RegularExpression() [3/4]

RegularExpression::RegularExpression ( const RegularExpression rhs)

Definition at line 20 of file RegularExpression.cpp.

◆ RegularExpression() [4/4]

lldb_private::RegularExpression::RegularExpression ( RegularExpression &&  rhs)
default

Member Function Documentation

◆ Execute()

bool RegularExpression::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 object against the given string.

If any parens are used for regular expression matches.

Parameters
[in]stringThe string to match against the compile regular expression.
[out]matchesA pointer to a SmallVector to hold the matches.
Returns
true if string matches the compiled regular expression, false otherwise incl. the case regular exression failed to compile.

Definition at line 23 of file RegularExpression.cpp.

References IsValid(), and m_regex.

Referenced by DWARFMappedHash::MemoryTable::AppendHashDataForRegularExpression(), lldb_private::Symtab::AppendSymbolIndexesMatchingRegExAndType(), InstructionLLVMC::CalculateMnemonicOperandsAndComment(), lldb_private::Disassembler::ElideMixedSourceAndDisassemblyLine(), NameToDIE::Find(), SymbolFilePDB::FindGlobalVariables(), lldb_private::SourceManager::File::FindLinesMatchingRegex(), SymbolFilePDB::FindTypesByRegex(), lldb_private::ThreadPlanStepInRange::FrameMatchesAvoidCriteria(), lldb_private::DebugNamesDWARFIndex::GetFunctions(), lldb_private::DebugNamesDWARFIndex::GetGlobalVariables(), lldb_private::UniqueCStringMap< EnumeratorInfo >::GetValues(), lldb_private::Variable::GetValuesForVariableExpressionPath(), lldb_private::FileSpec::IsSourceImplementationFile(), lldb_private::TypeMatcher::Matches(), lldb_private::InstrumentationRuntime::ModulesDidLoad(), lldb_private::NameMatches(), lldb_private::Variable::NameMatches(), DWARFUnit::ParseProducerInfo(), CommandObjectRenderScriptRuntimeReductionBreakpointSet::CommandOptions::ParseReductionTypes(), lldb_private::ClangREPL::PrintOneVariable(), lldb_private::Instruction::ReadArray(), lldb_private::Instruction::ReadDictionary(), lldb_private::OptionArgParser::ToAddress(), and lldb_private::process_gdb_remote::GDBRemoteCommunication::WaitForPacketNoLock().

◆ GetError()

llvm::Error RegularExpression::GetError ( ) const

Return an error if the regular expression failed to compile.

Returns
A string error if the regular expression failed to compile, success otherwise.

Definition at line 35 of file RegularExpression.cpp.

References error(), m_regex, and string().

Referenced by CommandObjectFrameVariable::DoExecute(), and CommandObjectBreakpointSet::DoExecute().

◆ GetText()

llvm::StringRef RegularExpression::GetText ( ) const

◆ IsValid()

bool RegularExpression::IsValid ( ) const

◆ operator=() [1/2]

RegularExpression& lldb_private::RegularExpression::operator= ( const RegularExpression rhs)
default

◆ operator=() [2/2]

RegularExpression& lldb_private::RegularExpression::operator= ( RegularExpression &&  rhs)
default

◆ operator==()

bool lldb_private::RegularExpression::operator== ( const RegularExpression rhs) const
inline

Definition at line 81 of file RegularExpression.h.

References GetText().

Member Data Documentation

◆ m_regex

llvm::Regex lldb_private::RegularExpression::m_regex
mutableprivate

The compiled regular expression.

Definition at line 89 of file RegularExpression.h.

Referenced by Execute(), GetError(), and IsValid().

◆ m_regex_text

std::string lldb_private::RegularExpression::m_regex_text
private

A copy of the original regular expression text.

Definition at line 87 of file RegularExpression.h.

Referenced by GetText().


The documentation for this class was generated from the following files: