#include <cstdio>
#include <sys/types.h>
#include <cstdlib>
#include <map>
#include <string>
#include "ClangUserExpression.h"
#include "ASTResultSynthesizer.h"
#include "ClangASTMetadata.h"
#include "ClangDiagnostic.h"
#include "ClangExpressionDeclMap.h"
#include "ClangExpressionParser.h"
#include "ClangModulesDeclVendor.h"
#include "ClangPersistentVariables.h"
#include "CppModuleConfiguration.h"
#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ValueObjectConstResult.h"
#include "lldb/Expression/ExpressionSourceCode.h"
#include "lldb/Expression/IRExecutionUnit.h"
#include "lldb/Expression/IRInterpreter.h"
#include "lldb/Expression/Materializer.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Symbol/Block.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Symbol/Type.h"
#include "lldb/Symbol/VariableList.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/ThreadPlan.h"
#include "lldb/Target/ThreadPlanCallUserExpression.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/BinaryFormat/Dwarf.h"
usingnamespacelldb_private;
char ClangUserExpression::ID;
ClangUserExpression::ClangUserExpression(
ExecutionContextScope &exe_scope, llvm::StringRef expr,
llvm::StringRef prefix, SourceLanguage language, ResultType desired_type,
const EvaluateExpressionOptions &options, ValueObject *ctx_obj)
: … { … }
ClangUserExpression::~ClangUserExpression() = default;
void ClangUserExpression::ScanContext(ExecutionContext &exe_ctx, Status &err) { … }
static void ApplyObjcCastHack(std::string &expr) { … }
bool ClangUserExpression::SetupPersistentState(DiagnosticManager &diagnostic_manager,
ExecutionContext &exe_ctx) { … }
static void SetupDeclVendor(ExecutionContext &exe_ctx, Target *target,
DiagnosticManager &diagnostic_manager) { … }
ClangExpressionSourceCode::WrapKind ClangUserExpression::GetWrapKind() const { … }
void ClangUserExpression::CreateSourceCode(
DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
std::vector<std::string> modules_to_import, bool for_completion) { … }
static bool SupportsCxxModuleImport(lldb::LanguageType language) { … }
static CppModuleConfiguration LogConfigError(const std::string &msg) { … }
CppModuleConfiguration GetModuleConfig(lldb::LanguageType language,
ExecutionContext &exe_ctx) { … }
bool ClangUserExpression::PrepareForParsing(
DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
bool for_completion) { … }
bool ClangUserExpression::TryParse(
DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
lldb_private::ExecutionPolicy execution_policy, bool keep_result_in_memory,
bool generate_debug_info) { … }
void ClangUserExpression::SetupCppModuleImports(ExecutionContext &exe_ctx) { … }
static bool shouldRetryWithCppModule(Target &target, ExecutionPolicy exe_policy) { … }
bool ClangUserExpression::Parse(DiagnosticManager &diagnostic_manager,
ExecutionContext &exe_ctx,
lldb_private::ExecutionPolicy execution_policy,
bool keep_result_in_memory,
bool generate_debug_info) { … }
static void AbsPosToLineColumnPos(size_t abs_pos, llvm::StringRef code,
unsigned &line, unsigned &column) { … }
bool ClangUserExpression::Complete(ExecutionContext &exe_ctx,
CompletionRequest &request,
unsigned complete_pos) { … }
lldb::addr_t ClangUserExpression::GetCppObjectPointer(
lldb::StackFrameSP frame_sp, llvm::StringRef object_name, Status &err) { … }
bool ClangUserExpression::AddArguments(ExecutionContext &exe_ctx,
std::vector<lldb::addr_t> &args,
lldb::addr_t struct_address,
DiagnosticManager &diagnostic_manager) { … }
lldb::ExpressionVariableSP ClangUserExpression::GetResultAfterDematerialization(
ExecutionContextScope *exe_scope) { … }
char ClangUserExpression::ClangUserExpressionHelper::ID;
void ClangUserExpression::ClangUserExpressionHelper::ResetDeclMap(
ExecutionContext &exe_ctx,
Materializer::PersistentVariableDelegate &delegate,
bool keep_result_in_memory,
ValueObject *ctx_obj) { … }
clang::ASTConsumer *
ClangUserExpression::ClangUserExpressionHelper::ASTTransformer(
clang::ASTConsumer *passthrough) { … }
void ClangUserExpression::ClangUserExpressionHelper::CommitPersistentDecls() { … }
ConstString ClangUserExpression::ResultDelegate::GetName() { … }
void ClangUserExpression::ResultDelegate::DidDematerialize(
lldb::ExpressionVariableSP &variable) { … }
void ClangUserExpression::ResultDelegate::RegisterPersistentState(
PersistentExpressionState *persistent_state) { … }
lldb::ExpressionVariableSP &ClangUserExpression::ResultDelegate::GetVariable() { … }