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

"lldb/Expression/ClangASTSource.h" Container for all objects relevant to a single name lookup More...

#include <NameSearchContext.h>

Public Member Functions

 NameSearchContext (TypeSystemClang &clang_ts, llvm::SmallVectorImpl< clang::NamedDecl * > &decls, clang::DeclarationName name, const clang::DeclContext *dc)
 Constructor.
 
clang::NamedDecl * AddVarDecl (const CompilerType &type)
 Create a VarDecl with the name being searched for and the provided type and register it in the right places.
 
clang::NamedDecl * AddFunDecl (const CompilerType &type, bool extern_c=false)
 Create a FunDecl with the name being searched for and the provided type and register it in the right places.
 
clang::NamedDecl * AddGenericFunDecl ()
 Create a FunDecl with the name being searched for and generic type (i.e.
 
clang::NamedDecl * AddTypeDecl (const CompilerType &compiler_type)
 Create a TypeDecl with the name being searched for and the provided type and register it in the right places.
 
void AddLookupResult (clang::DeclContextLookupResult result)
 Add Decls from the provided DeclContextLookupResult to the list of results.
 
void AddNamedDecl (clang::NamedDecl *decl)
 Add a NamedDecl to the list of results.
 

Public Attributes

TypeSystemClangm_clang_ts
 The type system of the AST from which the lookup originated.
 
llvm::SmallVectorImpl< clang::NamedDecl * > & m_decls
 The list of declarations already constructed.
 
ClangASTImporter::NamespaceMapSP m_namespace_map
 The mapping of all namespaces found for this request back to their modules.
 
const clang::DeclarationName m_decl_name
 The name being looked for.
 
const clang::DeclContext * m_decl_context
 The DeclContext to put declarations into.
 
llvm::SmallSet< CompilerType, 5 > m_function_types
 All the types of functions that have been reported, so we don't report conflicts.
 
bool m_found_variable = false
 
bool m_found_function_with_type_info = false
 
bool m_found_local_vars_nsp = false
 
bool m_found_type = false
 

Private Member Functions

clang::ASTContext & GetASTContext () const
 

Detailed Description

"lldb/Expression/ClangASTSource.h" Container for all objects relevant to a single name lookup

LLDB needs to create Decls for entities it finds. This class communicates what name is being searched for and provides helper functions to construct Decls given appropriate type information.

Definition at line 26 of file NameSearchContext.h.

Constructor & Destructor Documentation

◆ NameSearchContext()

lldb_private::NameSearchContext::NameSearchContext ( TypeSystemClang clang_ts,
llvm::SmallVectorImpl< clang::NamedDecl * > &  decls,
clang::DeclarationName  name,
const clang::DeclContext *  dc 
)
inline

Constructor.

Initializes class variables.

Parameters
[in]clang_tsThe TypeSystemClang from which the request originates.
[in]declsA reference to a list into which new Decls will be placed. This list is typically empty when the function is called.
[in]nameThe name being searched for (always an Identifier).
[in]dcThe DeclContext to register Decls in.

Definition at line 63 of file NameSearchContext.h.

Member Function Documentation

◆ AddFunDecl()

clang::NamedDecl * NameSearchContext::AddFunDecl ( const CompilerType type,
bool  extern_c = false 
)

Create a FunDecl with the name being searched for and the provided type and register it in the right places.

Parameters
[in]typeThe opaque QualType for the FunDecl being registered.
[in]extern_cIf true, build an extern "C" linkage specification for this.

Definition at line 38 of file NameSearchContext.cpp.

References lldb_private::TypeSystemClang::CheckOverloadedOperatorKindParameterCount(), lldb_private::CompilerType::TypeSystemSPWrapper::dyn_cast_or_null(), lldb_private::Expressions, lldb_private::GetLog(), lldb_private::ClangUtil::GetQualType(), lldb_private::CompilerType::GetTypeSystem(), lldb_private::TypeSystemClang::IsOperator(), lldb_private::CompilerType::IsValid(), LLDB_LOG, m_decl_context, m_decl_name, m_decls, and m_function_types.

Referenced by AddGenericFunDecl(), and lldb_private::ClangExpressionDeclMap::AddOneFunction().

◆ AddGenericFunDecl()

clang::NamedDecl * NameSearchContext::AddGenericFunDecl ( )

Create a FunDecl with the name being searched for and generic type (i.e.

intptr_t NAME_GOES_HERE(...)) and register it in the right places.

Definition at line 130 of file NameSearchContext.cpp.

References AddFunDecl(), GetASTContext(), lldb_private::TypeSystemClang::GetType(), and m_clang_ts.

Referenced by lldb_private::ClangExpressionDeclMap::AddOneFunction().

◆ AddLookupResult()

void NameSearchContext::AddLookupResult ( clang::DeclContextLookupResult  result)

Add Decls from the provided DeclContextLookupResult to the list of results.

Parameters
[in]resultThe DeclContextLookupResult, usually returned as the result of querying a DeclContext.

Definition at line 173 of file NameSearchContext.cpp.

References m_decls.

◆ AddNamedDecl()

void NameSearchContext::AddNamedDecl ( clang::NamedDecl *  decl)

◆ AddTypeDecl()

clang::NamedDecl * NameSearchContext::AddTypeDecl ( const CompilerType compiler_type)

Create a TypeDecl with the name being searched for and the provided type and register it in the right places.

Parameters
[in]compiler_typeThe opaque QualType for the TypeDecl being registered.

Definition at line 144 of file NameSearchContext.cpp.

References lldb_private::ClangUtil::GetQualType(), lldb_private::ClangUtil::IsClangType(), and m_decls.

Referenced by lldb_private::ClangExpressionDeclMap::AddOneType(), and lldb_private::ClangASTSource::FindExternalVisibleDecls().

◆ AddVarDecl()

clang::NamedDecl * NameSearchContext::AddVarDecl ( const CompilerType type)

◆ GetASTContext()

clang::ASTContext & lldb_private::NameSearchContext::GetASTContext ( ) const
inlineprivate

Definition at line 116 of file NameSearchContext.h.

References lldb_private::TypeSystemClang::getASTContext(), and m_clang_ts.

Referenced by AddGenericFunDecl().

Member Data Documentation

◆ m_clang_ts

TypeSystemClang& lldb_private::NameSearchContext::m_clang_ts

The type system of the AST from which the lookup originated.

Definition at line 28 of file NameSearchContext.h.

Referenced by AddGenericFunDecl(), and GetASTContext().

◆ m_decl_context

const clang::DeclContext* lldb_private::NameSearchContext::m_decl_context

◆ m_decl_name

const clang::DeclarationName lldb_private::NameSearchContext::m_decl_name

◆ m_decls

llvm::SmallVectorImpl<clang::NamedDecl *>& lldb_private::NameSearchContext::m_decls

The list of declarations already constructed.

Definition at line 30 of file NameSearchContext.h.

Referenced by AddFunDecl(), AddLookupResult(), AddNamedDecl(), lldb_private::ClangASTSource::AddNamespace(), AddTypeDecl(), and AddVarDecl().

◆ m_found_function_with_type_info

bool lldb_private::NameSearchContext::m_found_function_with_type_info = false

◆ m_found_local_vars_nsp

bool lldb_private::NameSearchContext::m_found_local_vars_nsp = false

◆ m_found_type

bool lldb_private::NameSearchContext::m_found_type = false

◆ m_found_variable

bool lldb_private::NameSearchContext::m_found_variable = false

◆ m_function_types

llvm::SmallSet<CompilerType, 5> lldb_private::NameSearchContext::m_function_types

All the types of functions that have been reported, so we don't report conflicts.

Definition at line 40 of file NameSearchContext.h.

Referenced by AddFunDecl().

◆ m_namespace_map

ClangASTImporter::NamespaceMapSP lldb_private::NameSearchContext::m_namespace_map

The mapping of all namespaces found for this request back to their modules.

Definition at line 33 of file NameSearchContext.h.

Referenced by lldb_private::ClangASTSource::FillNamespaceMap(), and lldb_private::ClangASTSource::FindExternalVisibleDecls().


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