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

Represents a generic declaration context in a program. More...

#include <CompilerDeclContext.h>

Public Member Functions

 CompilerDeclContext ()=default
 Constructs an invalid CompilerDeclContext.
 
 CompilerDeclContext (TypeSystem *type_system, void *decl_ctx)
 Constructs a CompilerDeclContext with the given opaque decl context and its respective TypeSystem instance.
 
 operator bool () const
 
bool operator< (const CompilerDeclContext &rhs) const
 
bool IsValid () const
 
std::vector< lldb_private::CompilerContextGetCompilerContext () const
 Populate a valid compiler context from the current decl context.
 
std::vector< CompilerDeclFindDeclByName (ConstString name, const bool ignore_using_decls)
 
bool IsClassMethod ()
 Checks if this decl context represents a method of a class.
 
lldb::LanguageType GetLanguage ()
 Determines the original language of the decl context.
 
bool IsContainedInLookup (CompilerDeclContext other) const
 Check if the given other decl context is contained in the lookup of this decl context (for example because the other context is a nested inline namespace).
 
TypeSystemGetTypeSystem () const
 
void * GetOpaqueDeclContext () const
 
void SetDeclContext (TypeSystem *type_system, void *decl_ctx)
 
void Clear ()
 
ConstString GetName () const
 
ConstString GetScopeQualifiedName () const
 

Private Attributes

TypeSystemm_type_system = nullptr
 
void * m_opaque_decl_ctx = nullptr
 

Detailed Description

Represents a generic declaration context in a program.

A declaration context is data structure that contains declarations (e.g. namespaces).

This class serves as an abstraction for a declaration context inside one of the TypeSystems implemented by the language plugins. It does not have any actual logic in it but only stores an opaque pointer and a pointer to the TypeSystem that gives meaning to this opaque pointer. All methods of this class should call their respective method in the TypeSystem interface and pass the opaque pointer along.

See also
lldb_private::TypeSystem

Definition at line 31 of file CompilerDeclContext.h.

Constructor & Destructor Documentation

◆ CompilerDeclContext() [1/2]

lldb_private::CompilerDeclContext::CompilerDeclContext ( )
default

Constructs an invalid CompilerDeclContext.

◆ CompilerDeclContext() [2/2]

lldb_private::CompilerDeclContext::CompilerDeclContext ( TypeSystem type_system,
void *  decl_ctx 
)
inline

Constructs a CompilerDeclContext with the given opaque decl context and its respective TypeSystem instance.

This constructor should only be called from the respective TypeSystem implementation.

See also
lldb_private::TypeSystemClang::CreateDeclContext(clang::DeclContext*)

Definition at line 43 of file CompilerDeclContext.h.

Member Function Documentation

◆ Clear()

void lldb_private::CompilerDeclContext::Clear ( )
inline

Definition at line 104 of file CompilerDeclContext.h.

References m_opaque_decl_ctx, and m_type_system.

◆ FindDeclByName()

std::vector< CompilerDecl > CompilerDeclContext::FindDeclByName ( ConstString  name,
const bool  ignore_using_decls 
)

◆ GetCompilerContext()

std::vector< lldb_private::CompilerContext > CompilerDeclContext::GetCompilerContext ( ) const

Populate a valid compiler context from the current decl context.

Returns
A valid vector of CompilerContext entries that describes this declaration context. The first entry in the vector is the parent of the subsequent entry, so the topmost entry is the global namespace.

Definition at line 63 of file CompilerDeclContext.cpp.

References lldb_private::TypeSystem::DeclContextGetCompilerContext(), IsValid(), m_opaque_decl_ctx, and m_type_system.

Referenced by lldb_private::TypeQuery::TypeQuery().

◆ GetLanguage()

lldb::LanguageType CompilerDeclContext::GetLanguage ( )

Determines the original language of the decl context.

Definition at line 43 of file CompilerDeclContext.cpp.

References lldb_private::TypeSystem::DeclContextGetLanguage(), IsValid(), m_opaque_decl_ctx, and m_type_system.

◆ GetName()

ConstString CompilerDeclContext::GetName ( ) const

◆ GetOpaqueDeclContext()

void * lldb_private::CompilerDeclContext::GetOpaqueDeclContext ( ) const
inline

◆ GetScopeQualifiedName()

ConstString CompilerDeclContext::GetScopeQualifiedName ( ) const

◆ GetTypeSystem()

TypeSystem * lldb_private::CompilerDeclContext::GetTypeSystem ( ) const
inline

◆ IsClassMethod()

bool CompilerDeclContext::IsClassMethod ( )

Checks if this decl context represents a method of a class.

Returns
Returns true if this is a decl context that represents a method in a struct, union or class.

Definition at line 37 of file CompilerDeclContext.cpp.

References lldb_private::TypeSystem::DeclContextIsClassMethod(), IsValid(), m_opaque_decl_ctx, and m_type_system.

Referenced by lldb_private::ClangExpressionDeclMap::LookupFunction(), and lldb_private::ClangExpressionDeclMap::SearchFunctionsInSymbolContexts().

◆ IsContainedInLookup()

bool CompilerDeclContext::IsContainedInLookup ( CompilerDeclContext  other) const

Check if the given other decl context is contained in the lookup of this decl context (for example because the other context is a nested inline namespace).

Parameters
[in]otherThe other decl context for which we should check if it is contained in the lookoup of this context.
Returns
Returns true iff the other decl context is contained in the lookup of this decl context.

Definition at line 49 of file CompilerDeclContext.cpp.

References lldb_private::TypeSystem::DeclContextIsContainedInLookup(), IsValid(), m_opaque_decl_ctx, and m_type_system.

Referenced by lldb_private::plugin::dwarf::SymbolFileDWARF::DIEInDeclContext(), and lldb_private::plugin::dwarf::SymbolFileDWARF::FindGlobalVariables().

◆ IsValid()

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

◆ operator bool()

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

Definition at line 48 of file CompilerDeclContext.h.

References IsValid().

◆ operator<()

bool lldb_private::CompilerDeclContext::operator< ( const CompilerDeclContext rhs) const
inline

Definition at line 50 of file CompilerDeclContext.h.

References m_opaque_decl_ctx, and m_type_system.

◆ SetDeclContext()

void lldb_private::CompilerDeclContext::SetDeclContext ( TypeSystem type_system,
void *  decl_ctx 
)
inline

Definition at line 99 of file CompilerDeclContext.h.

References m_opaque_decl_ctx, and m_type_system.

Member Data Documentation

◆ m_opaque_decl_ctx

void* lldb_private::CompilerDeclContext::m_opaque_decl_ctx = nullptr
private

◆ m_type_system

TypeSystem* lldb_private::CompilerDeclContext::m_type_system = nullptr
private

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