LLDB mainline
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
lldb_private::SourceLocationSpec Class Reference

"lldb/Core/SourceLocationSpec.h" A source location specifier class. More...

#include <SourceLocationSpec.h>

Public Member Functions

 SourceLocationSpec (FileSpec file_spec, uint32_t line, std::optional< uint16_t > column=std::nullopt, bool check_inlines=false, bool exact_match=false)
 Constructor.
 
 SourceLocationSpec ()=delete
 
 operator bool () const
 Convert to boolean operator.
 
bool operator! () const
 Logical NOT operator.
 
bool operator== (const SourceLocationSpec &rhs) const
 Equal to operator.
 
bool operator!= (const SourceLocationSpec &rhs) const
 Not equal to operator.
 
bool operator< (const SourceLocationSpec &rhs) const
 Less than to operator.
 
void Dump (Stream &s) const
 Dump this object to a Stream.
 
std::string GetString () const
 
FileSpec GetFileSpec () const
 
std::optional< uint32_t > GetLine () const
 
std::optional< uint16_t > GetColumn () const
 
bool GetCheckInlines () const
 
bool GetExactMatch () const
 

Static Public Member Functions

static int Compare (const SourceLocationSpec &lhs, const SourceLocationSpec &rhs)
 Compare two SourceLocationSpec objects.
 
static bool Equal (const SourceLocationSpec &lhs, const SourceLocationSpec &rhs, bool full)
 

Protected Attributes

Declaration m_declaration
 
bool m_check_inlines
 Tells if the resolver should look in inlined declaration.
 
bool m_exact_match
 Tells if the resolver should look for an exact match.
 

Detailed Description

"lldb/Core/SourceLocationSpec.h" A source location specifier class.

A source location specifier class that holds a Declaration object containing a FileSpec with line and column information. The column line is optional. It also holds search flags that can be fetched by resolvers to look inlined declarations and/or exact matches.

Definition at line 27 of file SourceLocationSpec.h.

Constructor & Destructor Documentation

◆ SourceLocationSpec() [1/2]

SourceLocationSpec::SourceLocationSpec ( FileSpec  file_spec,
uint32_t  line,
std::optional< uint16_t >  column = std::nullopt,
bool  check_inlines = false,
bool  exact_match = false 
)
explicit

Constructor.

Takes a file_spec with a line number and a column number. If column is null or not provided, it is set to std::nullopt.

Parameters
[in]file_specThe full or partial path to a file.
[in]lineThe line number in the source file.
[in]columnThe column number in the line of the source file.
[in]check_inlinesWhether to look for a match in inlined declaration.
[in]exact_matchWhether to look for an exact match.

Definition at line 17 of file SourceLocationSpec.cpp.

◆ SourceLocationSpec() [2/2]

lldb_private::SourceLocationSpec::SourceLocationSpec ( )
delete

Member Function Documentation

◆ Compare()

int SourceLocationSpec::Compare ( const SourceLocationSpec lhs,
const SourceLocationSpec rhs 
)
static

Compare two SourceLocationSpec objects.

If full is true, then the file_spec, the line and column must match. If full is false, then only the file_spec and line number for lhs and rhs are compared. This allows a SourceLocationSpec object that have no column information to match a SourceLocationSpec objects that have column information with matching file_spec and line component.

Parameters
[in]lhsA const reference to the Left Hand Side object to compare.
[in]rhsA const reference to the Right Hand Side object to compare.
[in]fullIf true, then the file_spec, the line and column must match for a compare to return zero (equal to). If false, then only the file_spec and line number for lhs and rhs are compared, else a full comparison is done.
Returns
-1 if lhs is less than rhs, 0 if lhs is equal to rhs, 1 if lhs is greater than rhs

Definition at line 47 of file SourceLocationSpec.cpp.

References lldb_private::Declaration::Compare(), and m_declaration.

Referenced by operator<().

◆ Dump()

void SourceLocationSpec::Dump ( Stream s) const

Dump this object to a Stream.

Dump the object to the supplied stream s, starting with the file name, then the line number and if available the column number.

Parameters
[in]sThe stream to which to dump the object description.

Definition at line 59 of file SourceLocationSpec.cpp.

References lldb_private::Declaration::Dump(), m_check_inlines, m_declaration, and m_exact_match.

Referenced by GetString(), and lldb_private::operator<<().

◆ Equal()

bool SourceLocationSpec::Equal ( const SourceLocationSpec lhs,
const SourceLocationSpec rhs,
bool  full 
)
static

Definition at line 52 of file SourceLocationSpec.cpp.

References GetFileSpec(), and GetLine().

◆ GetCheckInlines()

bool lldb_private::SourceLocationSpec::GetCheckInlines ( ) const
inline

◆ GetColumn()

std::optional< uint16_t > SourceLocationSpec::GetColumn ( ) const

◆ GetExactMatch()

bool lldb_private::SourceLocationSpec::GetExactMatch ( ) const
inline

◆ GetFileSpec()

FileSpec lldb_private::SourceLocationSpec::GetFileSpec ( ) const
inline

◆ GetLine()

std::optional< uint32_t > SourceLocationSpec::GetLine ( ) const

◆ GetString()

std::string SourceLocationSpec::GetString ( ) const

Definition at line 65 of file SourceLocationSpec.cpp.

References Dump(), and lldb_private::StreamString::GetString().

◆ operator bool()

SourceLocationSpec::operator bool ( ) const
explicit

Convert to boolean operator.

This allows code to check a SourceLocationSpec object to see if it contains anything valid using code such as:

SourceLocationSpec location_spec(...);
if (location_spec)
{ ...
"lldb/Core/SourceLocationSpec.h" A source location specifier class.
Returns
A pointer to this object if both the file_spec and the line are valid, nullptr otherwise.

Definition at line 24 of file SourceLocationSpec.cpp.

◆ operator!()

bool SourceLocationSpec::operator! ( ) const

Logical NOT operator.

This allows code to check a SourceLocationSpec object to see if it is invalid using code such as:

SourceLocationSpec location_spec(...);
if (!location_spec)
{ ...
Returns
Returns true if the object has an invalid file_spec or line number, false otherwise.

Definition at line 26 of file SourceLocationSpec.cpp.

◆ operator!=()

bool SourceLocationSpec::operator!= ( const SourceLocationSpec rhs) const

Not equal to operator.

Tests if this object is not equal to rhs.

Parameters
[in]rhsA const SourceLocationSpec object reference to compare this object to.
Returns
true if this object is equal to rhs, false otherwise.

Definition at line 34 of file SourceLocationSpec.cpp.

◆ operator<()

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

Less than to operator.

Tests if this object is less than rhs.

Parameters
[in]rhsA const SourceLocationSpec object reference to compare this object to.
Returns
true if this object is less than rhs, false otherwise.

Definition at line 38 of file SourceLocationSpec.cpp.

References Compare().

◆ operator==()

bool SourceLocationSpec::operator== ( const SourceLocationSpec rhs) const

Equal to operator.

Tests if this object is equal to rhs.

Parameters
[in]rhsA const SourceLocationSpec object reference to compare this object to.
Returns
true if this object is equal to rhs, false otherwise.

Definition at line 28 of file SourceLocationSpec.cpp.

References GetCheckInlines(), GetExactMatch(), m_check_inlines, m_declaration, and m_exact_match.

Member Data Documentation

◆ m_check_inlines

bool lldb_private::SourceLocationSpec::m_check_inlines
protected

Tells if the resolver should look in inlined declaration.

Definition at line 179 of file SourceLocationSpec.h.

Referenced by Dump(), GetCheckInlines(), and operator==().

◆ m_declaration

Declaration lldb_private::SourceLocationSpec::m_declaration
protected

Definition at line 177 of file SourceLocationSpec.h.

Referenced by Compare(), Dump(), GetColumn(), GetFileSpec(), GetLine(), and operator==().

◆ m_exact_match

bool lldb_private::SourceLocationSpec::m_exact_match
protected

Tells if the resolver should look for an exact match.

Definition at line 181 of file SourceLocationSpec.h.

Referenced by Dump(), GetExactMatch(), and operator==().


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