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>

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

Public Member Functions

 CompilerDeclContext ()=default
 Constructs an invalid CompilerDeclContext. More...
 
 CompilerDeclContext (TypeSystem *type_system, void *decl_ctx)
 Constructs a CompilerDeclContext with the given opaque decl context and its respective TypeSystem instance. More...
 
 operator bool () const
 
bool operator< (const CompilerDeclContext &rhs) const
 
bool IsValid () const
 
std::vector< CompilerDeclFindDeclByName (ConstString name, const bool ignore_using_decls)
 
bool IsClassMethod (lldb::LanguageType *language_ptr, bool *is_instance_method_ptr, ConstString *language_object_name_ptr)
 Checks if this decl context represents a method of a class. More...
 
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). More...
 
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 30 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 42 of file CompilerDeclContext.h.

Member Function Documentation

◆ Clear()

void lldb_private::CompilerDeclContext::Clear ( )
inline

◆ FindDeclByName()

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

◆ 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 ( lldb::LanguageType language_ptr,
bool *  is_instance_method_ptr,
ConstString language_object_name_ptr 
)

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

Parameters
[out]language_ptrIf non NULL and true is returned from this function, this will indicate if the language that respresents the method.
[out]is_instance_method_ptrIf non NULL and true is returned from this function, this will indicate if the method is an instance function (true) or a class method (false indicating the function is static, or doesn't require an instance of the class to be called).
[out]language_object_name_ptrIf non NULL and true is returned from this function, this will indicate if implicit object name for the language like "this" for C++, and "self" for Objective C.
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::SymbolContext::GetFunctionMethodInfo(), IsValid(), 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 47 of file CompilerDeclContext.cpp.

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

Referenced by SymbolFileDWARF::DIEInDeclContext(), and IsValid().

◆ IsValid()

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

◆ operator bool()

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

Definition at line 47 of file CompilerDeclContext.h.

References IsValid().

◆ operator<()

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

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