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/Symbol/Declaration.h"

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

Public Member Functions

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

Static Public Member Functions

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

Protected Attributes

FileSpec m_file
 Member variables. More...
 
uint32_t m_line
 Non-zero values indicates a valid line number, zero indicates no line number information is available. More...
 

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/4]

lldb_private::Declaration::Declaration ( )
inline

Default constructor.

Definition at line 27 of file Declaration.h.

Referenced by MemorySize().

◆ Declaration() [2/4]

lldb_private::Declaration::Declaration ( const FileSpec file_spec,
uint32_t  line = 0,
uint32_t  column = 0 
)
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 49 of file Declaration.h.

◆ Declaration() [3/4]

lldb_private::Declaration::Declaration ( const Declaration rhs)
inline

Construct with a reference to another Declaration object.

Definition at line 59 of file Declaration.h.

◆ Declaration() [4/4]

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

Construct with a pointer to another Declaration object.

Definition at line 69 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 84 of file Declaration.h.

References lldb_private::FileSpec::Clear(), Compare(), Dump(), DumpStopContext(), FileAndLineEqual(), m_file, and m_line.

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

◆ 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 69 of file Declaration.cpp.

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

Referenced by Clear(), lldb_private::FunctionInfo::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 m_file, m_line, and lldb_private::Stream::Printf().

Referenced by Clear(), lldb_private::Variable::Dump(), lldb_private::FunctionInfo::Dump(), lldb_private::Type::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 86 of file Declaration.cpp.

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

Referenced by Clear().

◆ GetColumn()

uint32_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 136 of file Declaration.h.

Referenced by 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 154 of file Declaration.h.

References m_file.

◆ GetLine()

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

Get accessor for the declaration line number.

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

Definition at line 161 of file Declaration.h.

References m_line.

Referenced by lldb_private::Block::AddRange(), lldb_private::BreakpointResolverFileLine::FilterContexts(), lldb::SBBlock::GetInlinedCallSiteLine(), lldb_private::SymbolContext::GetParentOfInlinedScope(), lldb_private::Function::GetStartLineSourceInfo(), GetSymbolDeclarationFromAddress(), and lldb_private::operator==().

◆ 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.
See also
ConstString::StaticMemorySize ()

Definition at line 67 of file Declaration.cpp.

References Declaration().

Referenced by IsValid(), and lldb_private::FunctionInfo::MemorySize().

◆ SetColumn()

void lldb_private::Declaration::SetColumn ( uint32_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 180 of file Declaration.h.

Referenced by GetDeclarationForSymbol(), DWARFASTParserClang::ParseChildEnumerators(), DWARFASTParserClang::ParseChildMembers(), DWARFASTParserClang::ParseChildParameters(), SymbolFilePDB::ParseDeclsForContext(), DWARFASTParserClang::ParseTypeFromDWARF(), SymbolFileDWARF::ParseVariableDIE(), and lldb::SBDeclaration::SetColumn().

◆ SetFile()

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

◆ 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 197 of file Declaration.h.

References m_line.

Referenced by GetDeclarationForSymbol(), DWARFASTParserClang::ParseChildEnumerators(), DWARFASTParserClang::ParseChildMembers(), DWARFASTParserClang::ParseChildParameters(), SymbolFilePDB::ParseDeclsForContext(), DWARFASTParserClang::ParseTypeFromDWARF(), SymbolFileDWARF::ParseVariableDIE(), and lldb::SBDeclaration::SetLine().

Member Data Documentation

◆ m_file

FileSpec lldb_private::Declaration::m_file
protected

Member variables.

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

Definition at line 201 of file Declaration.h.

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

◆ m_line

uint32_t lldb_private::Declaration::m_line
protected

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

Definition at line 203 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: