mirror of
https://github.com/intel/llvm.git
synced 2026-01-13 19:08:21 +08:00
[Target] Remove Target::GetScratchClangASTContext
Target doesn't really need to know about ClangASTContext more than any other TypeSystem. We can create a method ClangASTContext::GetScratch for anything who needs a ClangASTContext specifically instead of just a generic TypeSystem.
This commit is contained in:
@@ -30,7 +30,10 @@
|
||||
#include "lldb/Expression/ExpressionVariable.h"
|
||||
#include "lldb/Symbol/CompilerType.h"
|
||||
#include "lldb/Symbol/TypeSystem.h"
|
||||
#include "lldb/Target/Target.h"
|
||||
#include "lldb/Utility/ConstString.h"
|
||||
#include "lldb/Utility/Log.h"
|
||||
#include "lldb/Utility/Logging.h"
|
||||
#include "lldb/lldb-enumerations.h"
|
||||
|
||||
class DWARFASTParserClang;
|
||||
@@ -86,6 +89,18 @@ public:
|
||||
|
||||
static ClangASTContext *GetASTContext(clang::ASTContext *ast_ctx);
|
||||
|
||||
static ClangASTContext *GetScratch(Target &target,
|
||||
bool create_on_demand = true) {
|
||||
auto type_system_or_err = target.GetScratchTypeSystemForLanguage(
|
||||
lldb::eLanguageTypeC, create_on_demand);
|
||||
if (auto err = type_system_or_err.takeError()) {
|
||||
LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_TARGET),
|
||||
std::move(err), "Couldn't get scratch ClangASTContext");
|
||||
return nullptr;
|
||||
}
|
||||
return llvm::dyn_cast<ClangASTContext>(&type_system_or_err.get());
|
||||
}
|
||||
|
||||
clang::ASTContext *getASTContext();
|
||||
|
||||
clang::Builtin::Context *getBuiltinContext();
|
||||
|
||||
@@ -1067,8 +1067,6 @@ public:
|
||||
const char *name,
|
||||
Status &error);
|
||||
|
||||
ClangASTContext *GetScratchClangASTContext(bool create_on_demand = true);
|
||||
|
||||
lldb::ClangASTImporterSP GetClangASTImporter();
|
||||
|
||||
// Install any files through the platform that need be to installed prior to
|
||||
|
||||
@@ -1073,7 +1073,7 @@ DynamicLoaderDarwin::GetThreadLocalData(const lldb::ModuleSP module_sp,
|
||||
StackFrameSP frame_sp = thread_sp->GetStackFrameAtIndex(0);
|
||||
if (frame_sp) {
|
||||
ClangASTContext *clang_ast_context =
|
||||
target.GetScratchClangASTContext();
|
||||
ClangASTContext::GetScratch(target);
|
||||
|
||||
if (!clang_ast_context)
|
||||
return LLDB_INVALID_ADDRESS;
|
||||
|
||||
@@ -223,7 +223,10 @@ bool DynamicLoaderMacOS::NotifyBreakpointHit(void *baton,
|
||||
// get the values from the ABI:
|
||||
|
||||
ClangASTContext *clang_ast_context =
|
||||
process->GetTarget().GetScratchClangASTContext();
|
||||
ClangASTContext::GetScratch(process->GetTarget());
|
||||
if (!clang_ast_context)
|
||||
return false;
|
||||
|
||||
ValueList argument_values;
|
||||
|
||||
Value mode_value; // enum dyld_notify_mode { dyld_notify_adding=0,
|
||||
|
||||
@@ -342,7 +342,10 @@ bool DynamicLoaderMacOSXDYLD::NotifyBreakpointHit(
|
||||
// get the values from the ABI:
|
||||
|
||||
ClangASTContext *clang_ast_context =
|
||||
process->GetTarget().GetScratchClangASTContext();
|
||||
ClangASTContext::GetScratch(process->GetTarget());
|
||||
if (!clang_ast_context)
|
||||
return false;
|
||||
|
||||
ValueList argument_values;
|
||||
Value input_value;
|
||||
|
||||
|
||||
@@ -453,7 +453,7 @@ void ASTResultSynthesizer::CommitPersistentDecls() {
|
||||
ConstString name_cs(name.str().c_str());
|
||||
|
||||
Decl *D_scratch = m_target.GetClangASTImporter()->DeportDecl(
|
||||
m_target.GetScratchClangASTContext()->getASTContext(), m_ast_context,
|
||||
ClangASTContext::GetScratch(m_target)->getASTContext(), m_ast_context,
|
||||
decl);
|
||||
|
||||
if (!D_scratch) {
|
||||
|
||||
@@ -120,14 +120,17 @@ void ClangASTSource::InstallASTContext(ClangASTContext &clang_ast_context,
|
||||
// Update the scratch AST context's merger to reflect any new sources we
|
||||
// might have come across since the last time an expression was parsed.
|
||||
|
||||
auto scratch_ast_context = static_cast<ClangASTContextForExpressions*>(
|
||||
m_target->GetScratchClangASTContext());
|
||||
if (auto *clang_ast_context = ClangASTContext::GetScratch(*m_target)) {
|
||||
|
||||
scratch_ast_context->GetMergerUnchecked().AddSources(sources);
|
||||
auto scratch_ast_context =
|
||||
static_cast<ClangASTContextForExpressions *>(clang_ast_context);
|
||||
|
||||
sources.push_back({*scratch_ast_context->getASTContext(),
|
||||
*scratch_ast_context->getFileManager(),
|
||||
scratch_ast_context->GetOriginMap()});
|
||||
scratch_ast_context->GetMergerUnchecked().AddSources(sources);
|
||||
|
||||
sources.push_back({*scratch_ast_context->getASTContext(),
|
||||
*scratch_ast_context->getFileManager(),
|
||||
scratch_ast_context->GetOriginMap()});
|
||||
}
|
||||
}
|
||||
|
||||
m_merger_up =
|
||||
@@ -145,7 +148,7 @@ ClangASTSource::~ClangASTSource() {
|
||||
// demand by passing false to
|
||||
// Target::GetScratchClangASTContext(create_on_demand).
|
||||
ClangASTContext *scratch_clang_ast_context =
|
||||
m_target->GetScratchClangASTContext(false);
|
||||
ClangASTContext::GetScratch(*m_target, false);
|
||||
|
||||
if (!scratch_clang_ast_context)
|
||||
return;
|
||||
|
||||
@@ -108,7 +108,7 @@ bool ClangExpressionDeclMap::WillParse(ExecutionContext &exe_ctx,
|
||||
m_parser_vars->m_persistent_vars = llvm::cast<ClangPersistentVariables>(
|
||||
target->GetPersistentExpressionStateForLanguage(eLanguageTypeC));
|
||||
|
||||
if (!target->GetScratchClangASTContext())
|
||||
if (!ClangASTContext::GetScratch(*target))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ static clang::QualType ExportAllDeclaredTypes(
|
||||
TypeFromUser ClangExpressionDeclMap::DeportType(ClangASTContext &target,
|
||||
ClangASTContext &source,
|
||||
TypeFromParser parser_type) {
|
||||
assert(&target == m_target->GetScratchClangASTContext());
|
||||
assert(&target == ClangASTContext::GetScratch(*m_target));
|
||||
assert((TypeSystem *)&source == parser_type.GetTypeSystem());
|
||||
assert(source.getASTContext() == m_ast_context);
|
||||
|
||||
@@ -215,7 +215,7 @@ TypeFromUser ClangExpressionDeclMap::DeportType(ClangASTContext &target,
|
||||
source.getASTContext()->getSourceManager().getFileID(
|
||||
source.getASTContext()->getTranslationUnitDecl()->getLocation());
|
||||
auto scratch_ast_context = static_cast<ClangASTContextForExpressions *>(
|
||||
m_target->GetScratchClangASTContext());
|
||||
ClangASTContext::GetScratch(*m_target));
|
||||
clang::QualType exported_type = ExportAllDeclaredTypes(
|
||||
*m_merger_up.get(), scratch_ast_context->GetMergerUnchecked(),
|
||||
*source.getASTContext(), *source.getFileManager(),
|
||||
@@ -248,8 +248,11 @@ bool ClangExpressionDeclMap::AddPersistentVariable(const NamedDecl *decl,
|
||||
if (target == nullptr)
|
||||
return false;
|
||||
|
||||
TypeFromUser user_type =
|
||||
DeportType(*target->GetScratchClangASTContext(), *ast, parser_type);
|
||||
auto *clang_ast_context = ClangASTContext::GetScratch(*target);
|
||||
if (!clang_ast_context)
|
||||
return false;
|
||||
|
||||
TypeFromUser user_type = DeportType(*clang_ast_context, *ast, parser_type);
|
||||
|
||||
uint32_t offset = m_parser_vars->m_materializer->AddResultVariable(
|
||||
user_type, is_lvalue, m_keep_result_in_memory, m_result_delegate, err);
|
||||
@@ -284,7 +287,9 @@ bool ClangExpressionDeclMap::AddPersistentVariable(const NamedDecl *decl,
|
||||
if (target == nullptr)
|
||||
return false;
|
||||
|
||||
ClangASTContext *context(target->GetScratchClangASTContext());
|
||||
ClangASTContext *context = ClangASTContext::GetScratch(*target);
|
||||
if (!context)
|
||||
return false;
|
||||
|
||||
TypeFromUser user_type = DeportType(*context, *ast, parser_type);
|
||||
|
||||
@@ -777,7 +782,7 @@ void ClangExpressionDeclMap::SearchPersistenDecls(NameSearchContext &context,
|
||||
return;
|
||||
|
||||
ClangASTContext *scratch_clang_ast_context =
|
||||
target->GetScratchClangASTContext();
|
||||
ClangASTContext::GetScratch(*target);
|
||||
|
||||
if (!scratch_clang_ast_context)
|
||||
return;
|
||||
@@ -1714,7 +1719,9 @@ void ClangExpressionDeclMap::AddOneGenericVariable(NameSearchContext &context,
|
||||
if (target == nullptr)
|
||||
return;
|
||||
|
||||
ClangASTContext *scratch_ast_context = target->GetScratchClangASTContext();
|
||||
ClangASTContext *scratch_ast_context = ClangASTContext::GetScratch(*target);
|
||||
if (!scratch_ast_context)
|
||||
return;
|
||||
|
||||
TypeFromUser user_type(scratch_ast_context->GetBasicType(eBasicTypeVoid)
|
||||
.GetPointerType()
|
||||
|
||||
@@ -572,10 +572,13 @@ bool lldb_private::formatters::LibcxxWStringSummaryProvider(
|
||||
location_sp->GetPointeeData(extractor, 0, size);
|
||||
|
||||
// std::wstring::size() is measured in 'characters', not bytes
|
||||
auto wchar_t_size = valobj.GetTargetSP()
|
||||
->GetScratchClangASTContext()
|
||||
->GetBasicType(lldb::eBasicTypeWChar)
|
||||
.GetByteSize(nullptr);
|
||||
ClangASTContext *ast_context =
|
||||
ClangASTContext::GetScratch(*valobj.GetTargetSP());
|
||||
if (!ast_context)
|
||||
return false;
|
||||
|
||||
auto wchar_t_size =
|
||||
ast_context->GetBasicType(lldb::eBasicTypeWChar).GetByteSize(nullptr);
|
||||
if (!wchar_t_size)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -461,9 +461,8 @@ lldb_private::formatters::NSArrayMSyntheticFrontEndBase::NSArrayMSyntheticFrontE
|
||||
: SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_ptr_size(8),
|
||||
m_id_type() {
|
||||
if (valobj_sp) {
|
||||
auto *clang_ast_context = valobj_sp->GetExecutionContextRef()
|
||||
.GetTargetSP()
|
||||
->GetScratchClangASTContext();
|
||||
auto *clang_ast_context = ClangASTContext::GetScratch(
|
||||
*valobj_sp->GetExecutionContextRef().GetTargetSP());
|
||||
if (clang_ast_context)
|
||||
m_id_type = CompilerType(
|
||||
clang_ast_context,
|
||||
@@ -610,9 +609,8 @@ lldb_private::formatters::GenericNSArrayISyntheticFrontEnd<D32, D64, Inline>::
|
||||
if (valobj_sp) {
|
||||
CompilerType type = valobj_sp->GetCompilerType();
|
||||
if (type) {
|
||||
auto *clang_ast_context = valobj_sp->GetExecutionContextRef()
|
||||
.GetTargetSP()
|
||||
->GetScratchClangASTContext();
|
||||
auto *clang_ast_context = ClangASTContext::GetScratch(
|
||||
*valobj_sp->GetExecutionContextRef().GetTargetSP());
|
||||
if (clang_ast_context)
|
||||
m_id_type = CompilerType(clang_ast_context,
|
||||
clang_ast_context->getASTContext()
|
||||
@@ -780,11 +778,15 @@ lldb_private::formatters::NSArray1SyntheticFrontEnd::GetChildAtIndex(
|
||||
static const ConstString g_zero("[0]");
|
||||
|
||||
if (idx == 0) {
|
||||
CompilerType id_type(
|
||||
m_backend.GetTargetSP()->GetScratchClangASTContext()->GetBasicType(
|
||||
lldb::eBasicTypeObjCID));
|
||||
return m_backend.GetSyntheticChildAtOffset(
|
||||
m_backend.GetProcessSP()->GetAddressByteSize(), id_type, true, g_zero);
|
||||
auto *clang_ast_context =
|
||||
ClangASTContext::GetScratch(*m_backend.GetTargetSP());
|
||||
if (clang_ast_context) {
|
||||
CompilerType id_type(
|
||||
clang_ast_context->GetBasicType(lldb::eBasicTypeObjCID));
|
||||
return m_backend.GetSyntheticChildAtOffset(
|
||||
m_backend.GetProcessSP()->GetAddressByteSize(), id_type, true,
|
||||
g_zero);
|
||||
}
|
||||
}
|
||||
return lldb::ValueObjectSP();
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ NSDictionary_Additionals::GetAdditionalSynthetics() {
|
||||
static CompilerType GetLLDBNSPairType(TargetSP target_sp) {
|
||||
CompilerType compiler_type;
|
||||
|
||||
ClangASTContext *target_ast_context = target_sp->GetScratchClangASTContext();
|
||||
ClangASTContext *target_ast_context = ClangASTContext::GetScratch(*target_sp);
|
||||
|
||||
if (target_ast_context) {
|
||||
ConstString g___lldb_autogen_nspair("__lldb_autogen_nspair");
|
||||
|
||||
@@ -86,10 +86,10 @@ bool lldb_private::formatters::NSError_SummaryProvider(
|
||||
|
||||
ValueObjectSP domain_str_sp = ValueObject::CreateValueObjectFromData(
|
||||
"domain_str", isw.GetAsData(process_sp->GetByteOrder()),
|
||||
valobj.GetExecutionContextRef(), process_sp->GetTarget()
|
||||
.GetScratchClangASTContext()
|
||||
->GetBasicType(lldb::eBasicTypeVoid)
|
||||
.GetPointerType());
|
||||
valobj.GetExecutionContextRef(),
|
||||
ClangASTContext::GetScratch(process_sp->GetTarget())
|
||||
->GetBasicType(lldb::eBasicTypeVoid)
|
||||
.GetPointerType());
|
||||
|
||||
if (!domain_str_sp)
|
||||
return false;
|
||||
@@ -156,8 +156,8 @@ public:
|
||||
m_child_sp = CreateValueObjectFromData(
|
||||
"_userInfo", isw.GetAsData(process_sp->GetByteOrder()),
|
||||
m_backend.GetExecutionContextRef(),
|
||||
process_sp->GetTarget().GetScratchClangASTContext()->GetBasicType(
|
||||
lldb::eBasicTypeObjCID));
|
||||
ClangASTContext::GetScratch(process_sp->GetTarget())
|
||||
->GetBasicType(lldb::eBasicTypeObjCID));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -69,10 +69,12 @@ static bool ExtractFields(ValueObject &valobj, ValueObjectSP *name_sp,
|
||||
InferiorSizedWord userinfo_isw(userinfo, *process_sp);
|
||||
InferiorSizedWord reserved_isw(reserved, *process_sp);
|
||||
|
||||
CompilerType voidstar = process_sp->GetTarget()
|
||||
.GetScratchClangASTContext()
|
||||
->GetBasicType(lldb::eBasicTypeVoid)
|
||||
.GetPointerType();
|
||||
auto *clang_ast_context = ClangASTContext::GetScratch(process_sp->GetTarget());
|
||||
if (!clang_ast_context)
|
||||
return false;
|
||||
|
||||
CompilerType voidstar =
|
||||
clang_ast_context->GetBasicType(lldb::eBasicTypeVoid).GetPointerType();
|
||||
|
||||
if (name_sp)
|
||||
*name_sp = ValueObject::CreateValueObjectFromData(
|
||||
|
||||
@@ -53,9 +53,8 @@ public:
|
||||
if (!type_system)
|
||||
return false;
|
||||
|
||||
ClangASTContext *ast = m_backend.GetExecutionContextRef()
|
||||
.GetTargetSP()
|
||||
->GetScratchClangASTContext();
|
||||
ClangASTContext *ast = ClangASTContext::GetScratch(
|
||||
*m_backend.GetExecutionContextRef().GetTargetSP());
|
||||
if (!ast)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ NSString_Additionals::GetAdditionalSummaries() {
|
||||
static CompilerType GetNSPathStore2Type(Target &target) {
|
||||
static ConstString g_type_name("__lldb_autogen_nspathstore2");
|
||||
|
||||
ClangASTContext *ast_ctx = target.GetScratchClangASTContext();
|
||||
ClangASTContext *ast_ctx = ClangASTContext::GetScratch(target);
|
||||
|
||||
if (!ast_ctx)
|
||||
return CompilerType();
|
||||
|
||||
@@ -537,7 +537,10 @@ ValueObjectSP ItaniumABILanguageRuntime::GetExceptionObjectForThread(
|
||||
return {};
|
||||
|
||||
ClangASTContext *clang_ast_context =
|
||||
m_process->GetTarget().GetScratchClangASTContext();
|
||||
ClangASTContext::GetScratch(m_process->GetTarget());
|
||||
if (!clang_ast_context)
|
||||
return {};
|
||||
|
||||
CompilerType voidstar =
|
||||
clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
|
||||
|
||||
|
||||
@@ -111,7 +111,10 @@ bool AppleObjCRuntime::GetObjectDescription(Stream &strm, Value &value,
|
||||
}
|
||||
} else {
|
||||
// If it is not a pointer, see if we can make it into a pointer.
|
||||
ClangASTContext *ast_context = target->GetScratchClangASTContext();
|
||||
ClangASTContext *ast_context = ClangASTContext::GetScratch(*target);
|
||||
if (!ast_context)
|
||||
return false;
|
||||
|
||||
CompilerType opaque_type = ast_context->GetBasicType(eBasicTypeObjCID);
|
||||
if (!opaque_type)
|
||||
opaque_type = ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
|
||||
@@ -123,7 +126,9 @@ bool AppleObjCRuntime::GetObjectDescription(Stream &strm, Value &value,
|
||||
arg_value_list.PushValue(value);
|
||||
|
||||
// This is the return value:
|
||||
ClangASTContext *ast_context = target->GetScratchClangASTContext();
|
||||
ClangASTContext *ast_context = ClangASTContext::GetScratch(*target);
|
||||
if (!ast_context)
|
||||
return false;
|
||||
|
||||
CompilerType return_compiler_type = ast_context->GetCStringType(true);
|
||||
Value ret;
|
||||
@@ -494,9 +499,12 @@ ThreadSP AppleObjCRuntime::GetBacktraceThreadFromException(
|
||||
reserved_dict = reserved_dict->GetSyntheticValue();
|
||||
if (!reserved_dict) return ThreadSP();
|
||||
|
||||
ClangASTContext *clang_ast_context =
|
||||
ClangASTContext::GetScratch(*exception_sp->GetTargetSP());
|
||||
if (!clang_ast_context)
|
||||
return ThreadSP();
|
||||
CompilerType objc_id =
|
||||
exception_sp->GetTargetSP()->GetScratchClangASTContext()->GetBasicType(
|
||||
lldb::eBasicTypeObjCID);
|
||||
clang_ast_context->GetBasicType(lldb::eBasicTypeObjCID);
|
||||
ValueObjectSP return_addresses;
|
||||
|
||||
auto objc_object_from_address = [&exception_sp, &objc_id](uint64_t addr,
|
||||
|
||||
@@ -1301,7 +1301,7 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(
|
||||
return DescriptorMapUpdateResult::Fail();
|
||||
|
||||
thread_sp->CalculateExecutionContext(exe_ctx);
|
||||
ClangASTContext *ast = process->GetTarget().GetScratchClangASTContext();
|
||||
ClangASTContext *ast = ClangASTContext::GetScratch(process->GetTarget());
|
||||
|
||||
if (!ast)
|
||||
return DescriptorMapUpdateResult::Fail();
|
||||
@@ -1563,7 +1563,7 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapSharedCache() {
|
||||
return DescriptorMapUpdateResult::Fail();
|
||||
|
||||
thread_sp->CalculateExecutionContext(exe_ctx);
|
||||
ClangASTContext *ast = process->GetTarget().GetScratchClangASTContext();
|
||||
ClangASTContext *ast = ClangASTContext::GetScratch(process->GetTarget());
|
||||
|
||||
if (!ast)
|
||||
return DescriptorMapUpdateResult::Fail();
|
||||
@@ -2672,10 +2672,12 @@ class ObjCExceptionRecognizedStackFrame : public RecognizedStackFrame {
|
||||
const lldb::ABISP &abi = process_sp->GetABI();
|
||||
if (!abi) return;
|
||||
|
||||
CompilerType voidstar = process_sp->GetTarget()
|
||||
.GetScratchClangASTContext()
|
||||
->GetBasicType(lldb::eBasicTypeVoid)
|
||||
.GetPointerType();
|
||||
ClangASTContext *clang_ast_context =
|
||||
ClangASTContext::GetScratch(process_sp->GetTarget());
|
||||
if (!clang_ast_context)
|
||||
return;
|
||||
CompilerType voidstar =
|
||||
clang_ast_context->GetBasicType(lldb::eBasicTypeVoid).GetPointerType();
|
||||
|
||||
ValueList args;
|
||||
Value input_value;
|
||||
|
||||
@@ -522,7 +522,10 @@ bool AppleObjCTrampolineHandler::AppleObjCVTables::RefreshTrampolines(
|
||||
const ABI *abi = process->GetABI().get();
|
||||
|
||||
ClangASTContext *clang_ast_context =
|
||||
process->GetTarget().GetScratchClangASTContext();
|
||||
ClangASTContext::GetScratch(process->GetTarget());
|
||||
if (!clang_ast_context)
|
||||
return false;
|
||||
|
||||
ValueList argument_values;
|
||||
Value input_value;
|
||||
CompilerType clang_void_ptr_type =
|
||||
@@ -802,7 +805,10 @@ AppleObjCTrampolineHandler::SetupDispatchFunction(Thread &thread,
|
||||
|
||||
// Next make the runner function for our implementation utility function.
|
||||
ClangASTContext *clang_ast_context =
|
||||
thread.GetProcess()->GetTarget().GetScratchClangASTContext();
|
||||
ClangASTContext::GetScratch(thread.GetProcess()->GetTarget());
|
||||
if (!clang_ast_context)
|
||||
return LLDB_INVALID_ADDRESS;
|
||||
|
||||
CompilerType clang_void_ptr_type =
|
||||
clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
|
||||
Status error;
|
||||
@@ -895,7 +901,10 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
|
||||
|
||||
TargetSP target_sp(thread.CalculateTarget());
|
||||
|
||||
ClangASTContext *clang_ast_context = target_sp->GetScratchClangASTContext();
|
||||
ClangASTContext *clang_ast_context = ClangASTContext::GetScratch(*target_sp);
|
||||
if (!clang_ast_context)
|
||||
return ret_plan_sp;
|
||||
|
||||
ValueList argument_values;
|
||||
Value void_ptr_value;
|
||||
CompilerType clang_void_ptr_type =
|
||||
|
||||
@@ -706,7 +706,9 @@ PlatformPOSIX::MakeLoadImageUtilityFunction(ExecutionContext &exe_ctx,
|
||||
FunctionCaller *do_dlopen_function = nullptr;
|
||||
|
||||
// Fetch the clang types we will need:
|
||||
ClangASTContext *ast = process->GetTarget().GetScratchClangASTContext();
|
||||
ClangASTContext *ast = ClangASTContext::GetScratch(process->GetTarget());
|
||||
if (!ast)
|
||||
return nullptr;
|
||||
|
||||
CompilerType clang_void_pointer_type
|
||||
= ast->GetBasicType(eBasicTypeVoid).GetPointerType();
|
||||
@@ -948,7 +950,11 @@ uint32_t PlatformPOSIX::DoLoadImage(lldb_private::Process *process,
|
||||
|
||||
Value return_value;
|
||||
// Fetch the clang types we will need:
|
||||
ClangASTContext *ast = process->GetTarget().GetScratchClangASTContext();
|
||||
ClangASTContext *ast = ClangASTContext::GetScratch(process->GetTarget());
|
||||
if (!ast) {
|
||||
error.SetErrorString("dlopen error: Unable to get ClangASTContext");
|
||||
return LLDB_INVALID_IMAGE_TOKEN;
|
||||
}
|
||||
|
||||
CompilerType clang_void_pointer_type
|
||||
= ast->GetBasicType(eBasicTypeVoid).GetPointerType();
|
||||
|
||||
@@ -229,7 +229,7 @@ AppleGetItemInfoHandler::GetItemInfo(Thread &thread, uint64_t item,
|
||||
lldb::StackFrameSP thread_cur_frame = thread.GetStackFrameAtIndex(0);
|
||||
ProcessSP process_sp(thread.CalculateProcess());
|
||||
TargetSP target_sp(thread.CalculateTarget());
|
||||
ClangASTContext *clang_ast_context = target_sp->GetScratchClangASTContext();
|
||||
ClangASTContext *clang_ast_context = ClangASTContext::GetScratch(*target_sp);
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME));
|
||||
|
||||
GetItemInfoReturnInfo return_value;
|
||||
|
||||
@@ -177,7 +177,7 @@ lldb::addr_t AppleGetPendingItemsHandler::SetupGetPendingItemsFunction(
|
||||
// Next make the runner function for our implementation utility function.
|
||||
Status error;
|
||||
ClangASTContext *clang_ast_context =
|
||||
thread.GetProcess()->GetTarget().GetScratchClangASTContext();
|
||||
ClangASTContext::GetScratch(thread.GetProcess()->GetTarget());
|
||||
CompilerType get_pending_items_return_type =
|
||||
clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
|
||||
get_pending_items_caller =
|
||||
@@ -228,7 +228,7 @@ AppleGetPendingItemsHandler::GetPendingItems(Thread &thread, addr_t queue,
|
||||
lldb::StackFrameSP thread_cur_frame = thread.GetStackFrameAtIndex(0);
|
||||
ProcessSP process_sp(thread.CalculateProcess());
|
||||
TargetSP target_sp(thread.CalculateTarget());
|
||||
ClangASTContext *clang_ast_context = target_sp->GetScratchClangASTContext();
|
||||
ClangASTContext *clang_ast_context = ClangASTContext::GetScratch(*target_sp);
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME));
|
||||
|
||||
GetPendingItemsReturnInfo return_value;
|
||||
|
||||
@@ -191,7 +191,7 @@ AppleGetQueuesHandler::SetupGetQueuesFunction(Thread &thread,
|
||||
|
||||
// Next make the runner function for our implementation utility function.
|
||||
ClangASTContext *clang_ast_context =
|
||||
thread.GetProcess()->GetTarget().GetScratchClangASTContext();
|
||||
ClangASTContext::GetScratch(thread.GetProcess()->GetTarget());
|
||||
CompilerType get_queues_return_type =
|
||||
clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
|
||||
Status error;
|
||||
@@ -231,7 +231,7 @@ AppleGetQueuesHandler::GetCurrentQueues(Thread &thread, addr_t page_to_free,
|
||||
lldb::StackFrameSP thread_cur_frame = thread.GetStackFrameAtIndex(0);
|
||||
ProcessSP process_sp(thread.CalculateProcess());
|
||||
TargetSP target_sp(thread.CalculateTarget());
|
||||
ClangASTContext *clang_ast_context = target_sp->GetScratchClangASTContext();
|
||||
ClangASTContext *clang_ast_context = ClangASTContext::GetScratch(*target_sp);
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME));
|
||||
|
||||
GetQueuesReturnInfo return_value;
|
||||
|
||||
@@ -186,7 +186,7 @@ lldb::addr_t AppleGetThreadItemInfoHandler::SetupGetThreadItemInfoFunction(
|
||||
// Also make the FunctionCaller for this UtilityFunction:
|
||||
|
||||
ClangASTContext *clang_ast_context =
|
||||
thread.GetProcess()->GetTarget().GetScratchClangASTContext();
|
||||
ClangASTContext::GetScratch(thread.GetProcess()->GetTarget());
|
||||
CompilerType get_thread_item_info_return_type =
|
||||
clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
|
||||
|
||||
@@ -237,7 +237,7 @@ AppleGetThreadItemInfoHandler::GetThreadItemInfo(Thread &thread,
|
||||
lldb::StackFrameSP thread_cur_frame = thread.GetStackFrameAtIndex(0);
|
||||
ProcessSP process_sp(thread.CalculateProcess());
|
||||
TargetSP target_sp(thread.CalculateTarget());
|
||||
ClangASTContext *clang_ast_context = target_sp->GetScratchClangASTContext();
|
||||
ClangASTContext *clang_ast_context = ClangASTContext::GetScratch(*target_sp);
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME));
|
||||
|
||||
GetThreadItemInfoReturnInfo return_value;
|
||||
|
||||
@@ -412,7 +412,7 @@ void SystemRuntimeMacOSX::ReadLibdispatchTSDIndexes() {
|
||||
#endif
|
||||
|
||||
ClangASTContext *ast_ctx =
|
||||
m_process->GetTarget().GetScratchClangASTContext();
|
||||
ClangASTContext::GetScratch(m_process->GetTarget());
|
||||
if (ast_ctx->getASTContext() &&
|
||||
m_dispatch_tsd_indexes_addr != LLDB_INVALID_ADDRESS) {
|
||||
CompilerType uint16 =
|
||||
|
||||
@@ -2258,20 +2258,6 @@ Target::GetUtilityFunctionForLanguage(const char *text,
|
||||
return utility_fn;
|
||||
}
|
||||
|
||||
ClangASTContext *Target::GetScratchClangASTContext(bool create_on_demand) {
|
||||
if (!m_valid)
|
||||
return nullptr;
|
||||
|
||||
auto type_system_or_err =
|
||||
GetScratchTypeSystemForLanguage(eLanguageTypeC, create_on_demand);
|
||||
if (auto err = type_system_or_err.takeError()) {
|
||||
LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_TARGET),
|
||||
std::move(err), "Couldn't get scratch ClangASTContext");
|
||||
return nullptr;
|
||||
}
|
||||
return llvm::dyn_cast<ClangASTContext>(&type_system_or_err.get());
|
||||
}
|
||||
|
||||
ClangASTImporterSP Target::GetClangASTImporter() {
|
||||
if (m_valid) {
|
||||
if (!m_ast_importer_sp) {
|
||||
|
||||
Reference in New Issue
Block a user