Go to the documentation of this file.
9 #ifndef LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGEXPRESSIONDECLMAP_H
10 #define LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGEXPRESSIONDECLMAP_H
26 #include "clang/AST/Decl.h"
27 #include "llvm/ADT/DenseMap.h"
31 class ClangPersistentVariables;
81 bool keep_result_in_memory,
83 const lldb::TargetSP &target,
84 const std::shared_ptr<ClangASTImporter> &importer,
ValueObject *ctx_obj);
127 bool is_result,
bool is_lvalue);
150 llvm::Value *value,
size_t size,
245 Module *module =
nullptr);
281 lldb::ModuleSP module,
548 lldb::ValueObjectSP valobj);
562 lldb::ValueObjectSP valobj);
576 ValueObjectProviderTy valobj_provider);
587 lldb::ExpressionVariableSP &pvar_sp);
662 #endif // LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGEXPRESSIONDECLMAP_H
Materializer * m_materializer
If non-NULL, the materializer to use when reporting used variables.
void LookUpLldbClass(NameSearchContext &context)
Handles looking up $__lldb_class which requires special treatment.
void AddOneVariable(NameSearchContext &context, lldb::VariableSP var, lldb::ValueObjectSP valobj)
Use the NameSearchContext to generate a Decl for the given LLDB Variable, and put it in the Tuple lis...
bool GetStructInfo(uint32_t &num_elements, size_t &size, lldb::offset_t &alignment)
[Used by IRForTarget] Get general information about the laid-out struct after DoStructLayout() has be...
clang::ASTContext * m_ast_context
The AST context requests are coming in for.
The following values should not live beyond parsing.
TypeSystemClang * GetScratchContext(Target &target)
ExecutionContext m_exe_ctx
The execution context to use when parsing.
void DisableParserVars()
Deallocate parser-specific variables.
void InstallCodeGenerator(clang::ASTConsumer *code_gen)
bool GetVariableValue(lldb::VariableSP &var, lldb_private::Value &var_location, TypeFromUser *found_type=nullptr, TypeFromParser *parser_type=nullptr)
Get the value of a variable in a given execution context and return the associated Types if needed.
lldb::TargetSP target_sp
The Target for a given query.
Materializer::PersistentVariableDelegate * m_result_delegate
If non-NULL, used to report expression results to ClangUserExpression.
The following values contain layout information for the materialized struct, but are not specific to ...
size_t m_struct_size
The size of the struct in bytes.
void SearchPersistenDecls(NameSearchContext &context, const ConstString name)
Searches the persistent decls of the target for entities with the given name.
void EnableStructVars()
Activate struct variables.
void InstallDiagnosticManager(DiagnosticManager &diag_manager)
void LookUpLldbObjCClass(NameSearchContext &context)
Handles looking up $__lldb_objc_class which requires special treatment.
void AddOneGenericVariable(NameSearchContext &context, const Symbol &symbol)
Use the NameSearchContext to generate a Decl for the given LLDB symbol (treated as a variable),...
bool m_struct_laid_out
True if the struct has been laid out and the layout is valid (that is, no new fields have been added ...
std::unique_ptr< ParserVars > m_parser_vars
ClangPersistentVariables * m_persistent_vars
The persistent variables for the process.
void EnableParserVars()
Activate parser-specific variables.
void AddContextClassType(NameSearchContext &context, const TypeFromUser &type)
Adds the class in which the expression is evaluated to the lookup and prepares the class to be used a...
TypeFromUser DeportType(TypeSystemClang &target, TypeSystemClang &source, TypeFromParser parser_type)
Move a type out of the current ASTContext into another, but make sure to export all components of the...
TargetInfo m_target_info
Basic information about the target.
~ClangExpressionDeclMap() override
Destructor.
ExpressionVariableList m_found_entities
All entities that were looked up for the parser.
void LookupLocalVarNamespace(SymbolContext &sym_ctx, NameSearchContext &name_context)
Handles looking up the synthetic namespace that contains our local variables for the current frame.
bool AddPersistentVariable(const clang::NamedDecl *decl, ConstString name, TypeFromParser type, bool is_result, bool is_lvalue)
[Used by IRForTarget] Add a variable to the list of persistent variables for the process.
SymbolContextList SearchFunctionsInSymbolContexts(const SymbolContextList &sc_list, const CompilerDeclContext &frame_decl_context)
Searches for functions in the given SymbolContextList.
virtual clang::NamedDecl * GetPersistentDecl(ConstString name)
Retrieves the declaration with the given name from the storage of persistent declarations.
TargetInfo GetTargetInfo()
bool GetFunctionInfo(const clang::NamedDecl *decl, uint64_t &ptr)
[Used by IRForTarget] Get information about a function given its Decl.
ConstString m_result_name
The name of the result variable ($1, for example)
TypeSystemClang * GetTypeSystemClang()
bool LookupLocalVariable(NameSearchContext &context, ConstString name, SymbolContext &sym_ctx, const CompilerDeclContext &namespace_decl)
Looks up a local variable.
uint64_t GetParserID()
Get this parser's ID for use in extracting parser- and JIT-specific data from persistent variables.
TaggedASTType< 0 > TypeFromParser
void MaybeRegisterFunctionBody(clang::FunctionDecl *copied_function_decl)
Should be called on all copied functions.
void LookupFunction(NameSearchContext &context, lldb::ModuleSP module_sp, ConstString name, const CompilerDeclContext &namespace_decl)
Looks up a function.
ValueObject * m_ctx_obj
If not empty, then expression is evaluated in context of this object.
void AddOneType(NameSearchContext &context, const TypeFromUser &type)
Use the NameSearchContext to generate a Decl for the given type.
void DisableStructVars()
Deallocate struct variables.
clang::ASTConsumer * m_code_gen
If non-NULL, a code generator that receives new top-level functions.
lldb::ByteOrder byte_order
Represents a generic declaration context in a program.
ClangExpressionDeclMap(bool keep_result_in_memory, Materializer::PersistentVariableDelegate *result_delegate, const lldb::TargetSP &target, const std::shared_ptr< ClangASTImporter > &importer, ValueObject *ctx_obj)
Constructor.
DiagnosticManager * m_diagnostics
The following values should not live beyond parsing.
bool DoStructLayout()
[Used by IRForTarget] Finalize the struct, laying out the position of each object in it.
ExpressionVariableList m_struct_members
All entities that need to be placed in the struct.
lldb::offset_t m_struct_alignment
The alignment of the struct in bytes.
lldb::VariableSP FindGlobalVariable(Target &target, lldb::ModuleSP &module, ConstString name, const CompilerDeclContext &namespace_decl)
Given a target, find a variable that matches the given name and type.
SymbolContext m_sym_ctx
The symbol context to use in finding variables and types.
ClangExpressionVariable::ParserVars * AddExpressionVariable(NameSearchContext &context, TypeFromParser const &pt, lldb::ValueObjectSP valobj)
Use the NameSearchContext to generate a Decl for the given LLDB ValueObject, and put it in the list o...
void LookupInModulesDeclVendor(NameSearchContext &context, ConstString name)
Lookup entities in the ClangModulesDeclVendor.
bool AddValueToStruct(const clang::NamedDecl *decl, ConstString name, llvm::Value *value, size_t size, lldb::offset_t alignment)
[Used by IRForTarget] Add a variable to the struct that needs to be materialized each time the expres...
bool GetStructElement(const clang::NamedDecl *&decl, llvm::Value *&value, lldb::offset_t &offset, ConstString &name, uint32_t index)
[Used by IRForTarget] Get specific information about one field of the laid-out struct after DoStructL...
const ParserVars & operator=(const ParserVars &)=delete
static TypeSystemClang * GetForTarget(Target &target, llvm::Optional< IsolatedASTKind > ast_kind=DefaultAST, bool create_on_demand=true)
Returns the scratch TypeSystemClang for the given target.
void AddOneFunction(NameSearchContext &context, Function *fun, Symbol *sym)
Use the NameSearchContext to generate a Decl for the given function.
lldb::addr_t GetSymbolAddress(Target &target, Process *process, ConstString name, lldb::SymbolType symbol_type, Module *module=nullptr)
[Used by IRForTarget] Get the address of a symbol given nothing but its name.
A class that represents a running process on the host machine.
A TypeSystem implementation based on Clang.
std::unique_ptr< StructVars > m_struct_vars
void FindExternalVisibleDecls(NameSearchContext &context) override
[Used by ClangASTSource] Find all entities matching a given name, using a NameSearchContext to make D...
void AddOneRegister(NameSearchContext &context, const RegisterInfo *reg_info)
Use the NameSearchContext to generate a Decl for the given register.
bool WillParse(ExecutionContext &exe_ctx, Materializer *materializer)
Enable the state needed for parsing and IR transformation.
void DidParse()
Disable the state needed for parsing and IR transformation.
Target * GetTargetPtr() const
Returns a pointer to the target object.
bool m_keep_result_in_memory
True if result persistent variables generated by this expression should stay in memory.
ByteOrder
Byte ordering definitions.
bool m_enable_lookups
Set to true during parsing if we have found the first "$__lldb" name.