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

"lldb/Utility/RegularExpression.h" A C++ wrapper class for regex. More...

#include <RegularExpression.h>


class  Match

Public Member Functions

 RegularExpression ()
 Default constructor. More...
 RegularExpression (llvm::StringRef string)
 ~RegularExpression ()
 Destructor. More...
 RegularExpression (const RegularExpression &rhs)
const RegularExpressionoperator= (const RegularExpression &rhs)
bool Compile (llvm::StringRef string)
 Compile a regular expression. More...
bool Compile (const char *)=delete
bool Execute (llvm::StringRef string, Match *match=nullptr) const
 Executes a regular expression. More...
bool Execute (const char *, Match *=nullptr)=delete
size_t GetErrorAsCString (char *err_str, size_t err_str_max_len) const
void Free ()
 Free the compiled regular expression. More...
llvm::StringRef GetText () const
 Access the regular expression text. More...
bool IsValid () const
 Test if valid. More...
void Clear ()
int GetErrorCode () const
bool operator< (const RegularExpression &rhs) const

Detailed Description

"lldb/Utility/RegularExpression.h" A C++ wrapper class for regex.

This regular expression class wraps the posix regex functions regcomp(), regerror(), regexec(), and regfree() from the header file in /usr/include/regex.h.

Definition at line 58 of file RegularExpression.h.

Constructor & Destructor Documentation

◆ RegularExpression() [1/3]

RegularExpression::RegularExpression ( )

Default constructor.

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

Definition at line 25 of file RegularExpression.cpp.

◆ RegularExpression() [2/3]

RegularExpression::RegularExpression ( llvm::StringRef  string)

Definition at line 31 of file RegularExpression.cpp.

References Compile().

◆ ~RegularExpression()

RegularExpression::~RegularExpression ( )


Any previously compiled regular expression contained in this object will be freed.

Definition at line 53 of file RegularExpression.cpp.

References Free().

◆ RegularExpression() [3/3]

RegularExpression::RegularExpression ( const RegularExpression rhs)

Definition at line 37 of file RegularExpression.cpp.

References Compile(), GetText(), and operator=().

Member Function Documentation

◆ Clear()

void lldb_private::RegularExpression::Clear ( )

◆ Compile() [1/2]

bool RegularExpression::Compile ( llvm::StringRef  string)

Compile 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. Any previously compiled regular expression contained in this object will be freed.

[in]reA NULL terminated C string that represents the regular expression to compile.
true if the regular expression compiles successfully, false otherwise.

Definition at line 64 of file RegularExpression.cpp.

References DEFAULT_COMPILE_FLAGS, and Free().

Referenced by lldb_private::AddressResolverName::AddressResolverName(), CommandObjectFrameVariable::DoExecute(), operator=(), RegularExpression(), lldb_private::OptionValueRegex::SetCurrentValue(), lldb_private::CommandCompletions::SymbolCompleter::SymbolCompleter(), and lldb_private::process_gdb_remote::GDBRemoteCommunication::WaitForPacketNoLock().

◆ Compile() [2/2]

bool lldb_private::RegularExpression::Compile ( const char *  )

◆ Execute() [1/2]

bool RegularExpression::Execute ( llvm::StringRef  string,
Match match = nullptr 
) const

Executes a regular expression.

Execute a regular expression match using the compiled regular expression that is already in this object against the match string s. If any parens are used for regular expression matches match_count should indicate the number of regmatch_t values that are present in match_ptr.

[in]stringThe string to match against the compile regular expression.
[in]matchA pointer to a RegularExpression::Match structure that was properly initialized with the desired number of maximum matches, or nullptr if no parenthesized matching is needed.
true if string matches the compiled regular expression, false otherwise.

Definition at line 79 of file RegularExpression.cpp.

References lldb_private::RegularExpression::Match::Clear(), lldb_private::RegularExpression::Match::GetData(), and lldb_private::RegularExpression::Match::GetSize().

Referenced by DWARFMappedHash::MemoryTable::AppendHashDataForRegularExpression(), lldb_private::Symtab::AppendSymbolIndexesMatchingRegExAndType(), InstructionLLVMC::CalculateMnemonicOperandsAndComment(), lldb_private::Socket::DecodeHostAndPort(), lldb_private::Disassembler::ElideMixedSourceAndDisassemblyLine(), SymbolFilePDB::FindGlobalVariables(), lldb_private::SourceManager::File::FindLinesMatchingRegex(), SymbolFilePDB::FindTypesByRegex(), lldb_private::ThreadPlanStepInRange::FrameMatchesAvoidCriteria(), lldb_private::DebugNamesDWARFIndex::GetFunctions(), lldb_private::DebugNamesDWARFIndex::GetGlobalVariables(), GetItaniumDemangledStr(), DWARFUnit::GetSymbolFileDWARF(), lldb_private::UniqueCStringMap< EnumeratorInfo >::GetValues(), lldb_private::Variable::GetValuesForVariableExpressionPath(), lldb_private::FileSpec::IsSourceImplementationFile(), lldb_private::InstrumentationRuntime::ModulesDidLoad(), lldb_private::NameMatches(), lldb_private::Variable::NameMatches(), CommandObjectRenderScriptRuntimeReductionBreakpointSet::CommandOptions::ParseReductionTypes(), lldb_private::Instruction::ReadArray(), lldb_private::Instruction::ReadDictionary(), DynamicRegisterInfo::SetRegisterInfo(), lldb_private::ObjectFile::SplitArchivePathWithObject(), lldb_private::OptionArgParser::ToAddress(), and lldb_private::process_gdb_remote::GDBRemoteCommunication::WaitForPacketNoLock().

◆ Execute() [2/2]

bool lldb_private::RegularExpression::Execute ( const char *  ,
Match = nullptr 

◆ Free()

void RegularExpression::Free ( )

Free the compiled regular expression.

If this object contains a valid compiled regular expression, this function will free any resources it was consuming.

Definition at line 154 of file RegularExpression.cpp.

Referenced by Compile(), and ~RegularExpression().

◆ GetErrorAsCString()

size_t RegularExpression::GetErrorAsCString ( char *  err_str,
size_t  err_str_max_len 
) const

◆ GetErrorCode()

int lldb_private::RegularExpression::GetErrorCode ( ) const

Definition at line 186 of file RegularExpression.h.

References lldb_private::operator<().

◆ GetText()

llvm::StringRef RegularExpression::GetText ( ) const

◆ IsValid()

bool RegularExpression::IsValid ( ) const

◆ operator<()

bool RegularExpression::operator< ( const RegularExpression rhs) const

Definition at line 174 of file RegularExpression.cpp.

◆ operator=()

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

Definition at line 43 of file RegularExpression.cpp.

References Compile(), and GetText().

Referenced by RegularExpression().

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