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

A class that describes the declaration location of a lldb object. More...

#include "lldb/Core/Declaration.h"

Public Member Functions

 Declaration ()=default
 Default constructor.
 
 Declaration (const FileSpec &file_spec, uint32_t line=0, uint16_t column=LLDB_INVALID_COLUMN_NUMBER)
 Construct with file specification, and optional line and column.
 
 Declaration (const Declaration *decl_ptr)
 Construct with a pointer to another Declaration object.
 
void Clear ()
 Clear the object's state.
 
bool FileAndLineEqual (const Declaration &declaration) const
 Checks if this object has the same file and line as another declaration object.
 
void Dump (Stream *s, bool show_fullpaths) const
 Dump a description of this object to a Stream.
 
bool DumpStopContext (Stream *s, bool show_fullpaths) const
 
FileSpecGetFile ()
 Get accessor for file specification.
 
const FileSpecGetFile () const
 Get const accessor for file specification.
 
uint32_t GetLine () const
 Get accessor for the declaration line number.
 
uint16_t GetColumn () const
 Get accessor for the declaration column number.
 
 operator bool () const
 Convert to boolean operator.
 
bool IsValid () const
 
size_t MemorySize () const
 Get the memory cost of this object.
 
void SetFile (const FileSpec &file_spec)
 Set accessor for the declaration file specification.
 
void SetLine (uint32_t line)
 Set accessor for the declaration line number.
 
void SetColumn (uint16_t column)
 Set accessor for the declaration column number.
 

Static Public Member Functions

static int Compare (const Declaration &lhs, const Declaration &rhs)
 Compare two declaration objects.
 

Protected Attributes

FileSpec m_file
 The file specification that points to the source file where the declaration occurred.
 
uint32_t m_line = 0
 Non-zero values indicates a valid line number, zero indicates no line number information is available.
 
uint16_t m_column = LLDB_INVALID_COLUMN_NUMBER
 Non-zero values indicates a valid column number, zero indicates no column information is available.
 

Detailed Description

A class that describes the declaration location of a lldb object.

The declarations include the file specification, line number, and the column info and can help track where functions, blocks, inlined functions, types, variables, any many other debug core objects were declared.

Definition at line 24 of file Declaration.h.

Constructor & Destructor Documentation

◆ Declaration() [1/3]

lldb_private::Declaration::Declaration ( )
default

Default constructor.

Referenced by MemorySize().

◆ Declaration() [2/3]

lldb_private::Declaration::Declaration ( const FileSpec file_spec,
uint32_t  line = 0,
uint16_t  column = LLDB_INVALID_COLUMN_NUMBER 
)
inline

Construct with file specification, and optional line and column.

Parameters
[in]file_specThe file specification that describes where this was declared.
[in]lineThe line number that describes where this was declared. Set to zero if there is no line number information.
[in]columnThe column number that describes where this was declared. Set to zero if there is no column number information.

Definition at line 42 of file Declaration.h.

◆ Declaration() [3/3]

lldb_private::Declaration::Declaration ( const Declaration decl_ptr)
inline

Construct with a pointer to another Declaration object.

Definition at line 47 of file Declaration.h.

Member Function Documentation

◆ Clear()

void lldb_private::Declaration::Clear ( )
inline

Clear the object's state.

Sets the file specification to be empty, and the line and column to zero.

Definition at line 57 of file Declaration.h.

References lldb_private::FileSpec::Clear(), m_column, m_file, and m_line.

Referenced by lldb_private::ValueObject::GetDeclaration(), and DWARFASTParserClang::ParseStructureLikeDIE().

◆ Compare()

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

Compare two declaration objects.

Compares the two file specifications from lhs and rhs. If the file specifications are equal, then continue to compare the line number and column numbers respectively.

Parameters
[in]lhsThe Left Hand Side const Declaration object reference.
[in]rhsThe Right Hand Side const Declaration object reference.
Returns
-1 if lhs < rhs 0 if lhs == rhs 1 if lhs > rhs

Definition at line 58 of file Declaration.cpp.

References lldb_private::FileSpec::Compare(), m_column, m_file, and m_line.

Referenced by lldb_private::FunctionInfo::Compare(), lldb_private::SourceLocationSpec::Compare(), lldb::SBDeclaration::operator!=(), and lldb::SBDeclaration::operator==().

◆ Dump()

void Declaration::Dump ( Stream s,
bool  show_fullpaths 
) const

Dump a description of this object to a Stream.

Dump a description of the contents of this object to the supplied stream s.

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

Definition at line 14 of file Declaration.cpp.

References lldb_private::FileSpec::GetFilename(), LLDB_INVALID_COLUMN_NUMBER, m_column, m_file, m_line, and lldb_private::Stream::Printf().

Referenced by lldb_private::SourceLocationSpec::Dump(), lldb_private::Variable::Dump(), lldb_private::Type::Dump(), lldb_private::FunctionInfo::Dump(), and lldb_private::Type::GetDescription().

◆ DumpStopContext()

bool Declaration::DumpStopContext ( Stream s,
bool  show_fullpaths 
) const

◆ FileAndLineEqual()

bool Declaration::FileAndLineEqual ( const Declaration declaration) const

Checks if this object has the same file and line as another declaration object.

Parameters
[in]declarationThe const Declaration object to compare with.
Returns
Returns true if declaration is at the same file and line, false otherwise.

Definition at line 73 of file Declaration.cpp.

References lldb_private::FileSpec::Compare(), m_file, and m_line.

◆ GetColumn()

uint16_t lldb_private::Declaration::GetColumn ( ) const
inline

Get accessor for the declaration column number.

Returns
Non-zero indicates a valid column number, zero indicates no column information is available.

Definition at line 127 of file Declaration.h.

References m_column.

Referenced by lldb_private::SourceLocationSpec::GetColumn(), lldb::SBBlock::GetInlinedCallSiteColumn(), lldb_private::SymbolContext::GetParentOfInlinedScope(), and lldb_private::operator==().

◆ GetFile() [1/2]

FileSpec & lldb_private::Declaration::GetFile ( )
inline

◆ GetFile() [2/2]

const FileSpec & lldb_private::Declaration::GetFile ( ) const
inline

Get const accessor for file specification.

Returns
A const reference to the file specification object.

Definition at line 113 of file Declaration.h.

References m_file.

◆ GetLine()

uint32_t lldb_private::Declaration::GetLine ( ) const
inline

◆ IsValid()

bool lldb_private::Declaration::IsValid ( ) const
inline

◆ MemorySize()

size_t Declaration::MemorySize ( ) const

Get the memory cost of this object.

Returns
The number of bytes that this object occupies in memory. The returned value does not include the bytes for any shared string values.

Definition at line 56 of file Declaration.cpp.

References Declaration().

Referenced by lldb_private::FunctionInfo::MemorySize().

◆ operator bool()

lldb_private::Declaration::operator bool ( ) const
inlineexplicit

Convert to boolean operator.

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

Declaration decl(...);
if (decl)
{ ...
A class that describes the declaration location of a lldb object.
Definition: Declaration.h:24
Returns
A true if both the file_spec and the line are valid, false otherwise.

Definition at line 143 of file Declaration.h.

References IsValid().

◆ SetColumn()

void lldb_private::Declaration::SetColumn ( uint16_t  column)
inline

Set accessor for the declaration column number.

Parameters
[in]columnNon-zero indicates a valid column number, zero indicates no column information is available.

Definition at line 175 of file Declaration.h.

References m_column.

Referenced by AddSourceInfoToDecl(), DWARFASTParserClang::ParseChildEnumerators(), ParsedDWARFTypeAttributes::ParsedDWARFTypeAttributes(), lldb_private::plugin::dwarf::SymbolFileDWARF::ParseVariableDIE(), SymbolFilePDB::ParseVariableForPDBData(), and lldb::SBDeclaration::SetColumn().

◆ SetFile()

void lldb_private::Declaration::SetFile ( const FileSpec file_spec)
inline

Set accessor for the declaration file specification.

Parameters
[in]file_specThe new declaration file specification.

Definition at line 161 of file Declaration.h.

References m_file.

Referenced by AddSourceInfoToDecl(), DWARFASTParserClang::ParseChildEnumerators(), ParsedDWARFTypeAttributes::ParsedDWARFTypeAttributes(), lldb_private::plugin::dwarf::SymbolFileDWARF::ParseVariableDIE(), SymbolFilePDB::ParseVariableForPDBData(), and lldb::SBDeclaration::SetFileSpec().

◆ SetLine()

void lldb_private::Declaration::SetLine ( uint32_t  line)
inline

Set accessor for the declaration line number.

Parameters
[in]lineNon-zero indicates a valid line number, zero indicates no line information is available.

Definition at line 168 of file Declaration.h.

References m_line.

Referenced by AddSourceInfoToDecl(), DWARFASTParserClang::ParseChildEnumerators(), ParsedDWARFTypeAttributes::ParsedDWARFTypeAttributes(), lldb_private::plugin::dwarf::SymbolFileDWARF::ParseVariableDIE(), SymbolFilePDB::ParseVariableForPDBData(), and lldb::SBDeclaration::SetLine().

Member Data Documentation

◆ m_column

uint16_t lldb_private::Declaration::m_column = LLDB_INVALID_COLUMN_NUMBER
protected

Non-zero values indicates a valid column number, zero indicates no column information is available.

Definition at line 186 of file Declaration.h.

Referenced by Clear(), Compare(), Dump(), DumpStopContext(), GetColumn(), and SetColumn().

◆ m_file

FileSpec lldb_private::Declaration::m_file
protected

The file specification that points to the source file where the declaration occurred.

Definition at line 180 of file Declaration.h.

Referenced by Clear(), Compare(), Dump(), DumpStopContext(), FileAndLineEqual(), GetFile(), IsValid(), and SetFile().

◆ m_line

uint32_t lldb_private::Declaration::m_line = 0
protected

Non-zero values indicates a valid line number, zero indicates no line number information is available.

Definition at line 183 of file Declaration.h.

Referenced by Clear(), Compare(), Dump(), DumpStopContext(), FileAndLineEqual(), GetLine(), IsValid(), and SetLine().


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