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

#include <RegularExpression.h>

Public Member Functions

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

Private Attributes

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

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,
llvm::Regex::RegexFlags  flags = llvm::Regex::NoFlags 
)
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.
[in]flagsAn llvm::Regex::RegexFlags that modifies the matching behavior. The default is NoFlags.

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 21 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 24 of file RegularExpression.cpp.

References IsValid(), and m_regex.

Referenced by lldb_private::Symtab::AppendSymbolIndexesMatchingRegExAndType(), InstructionLLVMC::CalculateMnemonicOperandsAndComment(), lldb_private::OptionArgParser::DoToAddress(), lldb_private::Disassembler::ElideMixedSourceAndDisassemblyLine(), lldb_private::plugin::dwarf::NameToDIE::Find(), lldb_private::SymbolFileCTF::FindFunctions(), lldb_private::SymbolFileCTF::FindGlobalVariables(), SymbolFilePDB::FindGlobalVariables(), lldb_private::SourceManager::File::FindLinesMatchingRegex(), lldb_private::SymbolFileCTF::FindTypesByRegex(), SymbolFilePDB::FindTypesByRegex(), lldb_private::ThreadPlanStepInRange::FrameMatchesAvoidCriteria(), lldb_private::plugin::dwarf::DebugNamesDWARFIndex::GetFunctions(), lldb_private::UniqueCStringMap< T >::GetValues(), lldb_private::Variable::GetValuesForVariableExpressionPath(), lldb_private::FileSpec::IsSourceImplementationFile(), lldb_private::TypeMatcher::Matches(), lldb_private::InstrumentationRuntime::ModulesDidLoad(), lldb_private::Mangled::NameMatches(), lldb_private::Variable::NameMatches(), lldb_private::NameMatches(), lldb_private::plugin::dwarf::DWARFUnit::ParseProducerInfo(), lldb_private::ClangREPL::PrintOneVariable(), lldb_private::Instruction::ReadArray(), lldb_private::Instruction::ReadDictionary(), LibCXXFrameRecognizer::RecognizeFrame(), CommandObjectTypeFormatterList< FormatterType >::ShouldListItem(), 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 36 of file RegularExpression.cpp.

References error(), and m_regex.

Referenced by CommandObjectBreakpointSet::DoExecute(), CommandObjectFrameVariable::DoExecute(), and lldb_private::OptionValueRegex::SetValueFromString().

◆ 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 87 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 95 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 93 of file RegularExpression.h.

Referenced by GetText().


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