Author: Raphael Isemann Date: 2020-12-04T11:29:08+01:00 New Revision: 594308c7ad07b4cea20f41d915aa81794e909654
URL: https://github.com/llvm/llvm-project/commit/594308c7ad07b4cea20f41d915aa81794e909654 DIFF: https://github.com/llvm/llvm-project/commit/594308c7ad07b4cea20f41d915aa81794e909654.diff LOG: [lldb][NFC] Rename TypeSystemClang::GetScratch to ScratchTypeSystemClang::GetForTarget Also add some documentation while I'm at it. Added: Modified: lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp lldb/source/Plugins/Language/ObjC/NSArray.cpp lldb/source/Plugins/Language/ObjC/NSDictionary.cpp lldb/source/Plugins/Language/ObjC/NSError.cpp lldb/source/Plugins/Language/ObjC/NSException.cpp lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp lldb/source/Plugins/Language/ObjC/NSString.cpp lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h Removed: ################################################################################ diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp index 569d84d39c807..e35e6063a0f1c 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp @@ -1113,7 +1113,7 @@ DynamicLoaderDarwin::GetThreadLocalData(const lldb::ModuleSP module_sp, StackFrameSP frame_sp = thread_sp->GetStackFrameAtIndex(0); if (frame_sp) { TypeSystemClang *clang_ast_context = - TypeSystemClang::GetScratch(target); + ScratchTypeSystemClang::GetForTarget(target); if (!clang_ast_context) return LLDB_INVALID_ADDRESS; diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp index 7bc14061ffe05..9fc5e5daeafb5 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp @@ -224,7 +224,7 @@ bool DynamicLoaderMacOS::NotifyBreakpointHit(void *baton, // get the values from the ABI: TypeSystemClang *clang_ast_context = - TypeSystemClang::GetScratch(process->GetTarget()); + ScratchTypeSystemClang::GetForTarget(process->GetTarget()); if (!clang_ast_context) return false; diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp index d425b3587237c..76b4c48110941 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -343,7 +343,7 @@ bool DynamicLoaderMacOSXDYLD::NotifyBreakpointHit( // get the values from the ABI: TypeSystemClang *clang_ast_context = - TypeSystemClang::GetScratch(process->GetTarget()); + ScratchTypeSystemClang::GetForTarget(process->GetTarget()); if (!clang_ast_context) return false; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp index 39ba5f4e9e4fd..66a87ba924dba 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp @@ -443,7 +443,7 @@ void ASTResultSynthesizer::CommitPersistentDecls() { return; auto *persistent_vars = llvm::cast<ClangPersistentVariables>(state); - TypeSystemClang *scratch_ctx = TypeSystemClang::GetScratch(m_target); + TypeSystemClang *scratch_ctx = ScratchTypeSystemClang::GetForTarget(m_target); for (clang::NamedDecl *decl : m_decls) { StringRef name = decl->getName(); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp index 783a5f1788039..cf34d9359f118 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp @@ -75,7 +75,7 @@ ClangASTSource::~ClangASTSource() { // demand by passing false to // Target::GetScratchTypeSystemClang(create_on_demand). TypeSystemClang *scratch_clang_ast_context = - TypeSystemClang::GetScratch(*m_target, false); + ScratchTypeSystemClang::GetForTarget(*m_target, false); if (!scratch_clang_ast_context) return; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp index 7d8cd85500aed..c455e08bc327b 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp @@ -110,7 +110,7 @@ bool ClangExpressionDeclMap::WillParse(ExecutionContext &exe_ctx, m_parser_vars->m_persistent_vars = llvm::cast<ClangPersistentVariables>( target->GetPersistentExpressionStateForLanguage(eLanguageTypeC)); - if (!TypeSystemClang::GetScratch(*target)) + if (!ScratchTypeSystemClang::GetForTarget(*target)) return false; } @@ -184,7 +184,7 @@ ClangExpressionDeclMap::TargetInfo ClangExpressionDeclMap::GetTargetInfo() { TypeFromUser ClangExpressionDeclMap::DeportType(TypeSystemClang &target, TypeSystemClang &source, TypeFromParser parser_type) { - assert(&target == TypeSystemClang::GetScratch(*m_target)); + assert(&target == ScratchTypeSystemClang::GetForTarget(*m_target)); assert((TypeSystem *)&source == parser_type.GetTypeSystem()); assert(&source.getASTContext() == m_ast_context); @@ -222,7 +222,7 @@ bool ClangExpressionDeclMap::AddPersistentVariable(const NamedDecl *decl, if (target == nullptr) return false; - auto *clang_ast_context = TypeSystemClang::GetScratch(*target); + auto *clang_ast_context = ScratchTypeSystemClang::GetForTarget(*target); if (!clang_ast_context) return false; @@ -260,7 +260,7 @@ bool ClangExpressionDeclMap::AddPersistentVariable(const NamedDecl *decl, if (target == nullptr) return false; - TypeSystemClang *context = TypeSystemClang::GetScratch(*target); + TypeSystemClang *context = ScratchTypeSystemClang::GetForTarget(*target); if (!context) return false; @@ -721,7 +721,7 @@ clang::NamedDecl *ClangExpressionDeclMap::GetPersistentDecl(ConstString name) { if (!target) return nullptr; - TypeSystemClang::GetScratch(*target); + ScratchTypeSystemClang::GetForTarget(*target); if (!m_parser_vars->m_persistent_vars) return nullptr; @@ -1638,7 +1638,8 @@ void ClangExpressionDeclMap::AddOneGenericVariable(NameSearchContext &context, if (target == nullptr) return; - TypeSystemClang *scratch_ast_context = TypeSystemClang::GetScratch(*target); + TypeSystemClang *scratch_ast_context = + ScratchTypeSystemClang::GetForTarget(*target); if (!scratch_ast_context) return; diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp index 84dd09a47d8ac..2b16ebe79daf1 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp @@ -692,7 +692,7 @@ bool lldb_private::formatters::LibcxxWStringSummaryProvider( // std::wstring::size() is measured in 'characters', not bytes TypeSystemClang *ast_context = - TypeSystemClang::GetScratch(*valobj.GetTargetSP()); + ScratchTypeSystemClang::GetForTarget(*valobj.GetTargetSP()); if (!ast_context) return false; diff --git a/lldb/source/Plugins/Language/ObjC/NSArray.cpp b/lldb/source/Plugins/Language/ObjC/NSArray.cpp index 26dea77c2e490..b0398dd19c021 100644 --- a/lldb/source/Plugins/Language/ObjC/NSArray.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSArray.cpp @@ -441,7 +441,7 @@ 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 = TypeSystemClang::GetScratch( + auto *clang_ast_context = ScratchTypeSystemClang::GetForTarget( *valobj_sp->GetExecutionContextRef().GetTargetSP()); if (clang_ast_context) m_id_type = CompilerType( @@ -589,7 +589,7 @@ lldb_private::formatters::GenericNSArrayISyntheticFrontEnd<D32, D64, Inline>:: if (valobj_sp) { CompilerType type = valobj_sp->GetCompilerType(); if (type) { - auto *clang_ast_context = TypeSystemClang::GetScratch( + auto *clang_ast_context = ScratchTypeSystemClang::GetForTarget( *valobj_sp->GetExecutionContextRef().GetTargetSP()); if (clang_ast_context) m_id_type = clang_ast_context->GetType( @@ -758,7 +758,7 @@ lldb_private::formatters::NSArray1SyntheticFrontEnd::GetChildAtIndex( if (idx == 0) { auto *clang_ast_context = - TypeSystemClang::GetScratch(*m_backend.GetTargetSP()); + ScratchTypeSystemClang::GetForTarget(*m_backend.GetTargetSP()); if (clang_ast_context) { CompilerType id_type( clang_ast_context->GetBasicType(lldb::eBasicTypeObjCID)); diff --git a/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp b/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp index b3209160cecf0..afb9c6951f552 100644 --- a/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp @@ -66,7 +66,8 @@ NSDictionary_Additionals::GetAdditionalSynthetics() { static CompilerType GetLLDBNSPairType(TargetSP target_sp) { CompilerType compiler_type; - TypeSystemClang *target_ast_context = TypeSystemClang::GetScratch(*target_sp); + TypeSystemClang *target_ast_context = + ScratchTypeSystemClang::GetForTarget(*target_sp); if (target_ast_context) { ConstString g___lldb_autogen_nspair("__lldb_autogen_nspair"); diff --git a/lldb/source/Plugins/Language/ObjC/NSError.cpp b/lldb/source/Plugins/Language/ObjC/NSError.cpp index aa1103cb342cb..4ffa072f9f534 100644 --- a/lldb/source/Plugins/Language/ObjC/NSError.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSError.cpp @@ -87,7 +87,7 @@ bool lldb_private::formatters::NSError_SummaryProvider( ValueObjectSP domain_str_sp = ValueObject::CreateValueObjectFromData( "domain_str", isw.GetAsData(process_sp->GetByteOrder()), valobj.GetExecutionContextRef(), - TypeSystemClang::GetScratch(process_sp->GetTarget()) + ScratchTypeSystemClang::GetForTarget(process_sp->GetTarget()) ->GetBasicType(lldb::eBasicTypeVoid) .GetPointerType()); @@ -156,7 +156,7 @@ class NSErrorSyntheticFrontEnd : public SyntheticChildrenFrontEnd { m_child_sp = CreateValueObjectFromData( "_userInfo", isw.GetAsData(process_sp->GetByteOrder()), m_backend.GetExecutionContextRef(), - TypeSystemClang::GetScratch(process_sp->GetTarget()) + ScratchTypeSystemClang::GetForTarget(process_sp->GetTarget()) ->GetBasicType(lldb::eBasicTypeObjCID)); return false; } diff --git a/lldb/source/Plugins/Language/ObjC/NSException.cpp b/lldb/source/Plugins/Language/ObjC/NSException.cpp index c6bae5e1c0087..7360abb8fdd29 100644 --- a/lldb/source/Plugins/Language/ObjC/NSException.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSException.cpp @@ -69,7 +69,8 @@ static bool ExtractFields(ValueObject &valobj, ValueObjectSP *name_sp, InferiorSizedWord userinfo_isw(userinfo, *process_sp); InferiorSizedWord reserved_isw(reserved, *process_sp); - auto *clang_ast_context = TypeSystemClang::GetScratch(process_sp->GetTarget()); + auto *clang_ast_context = + ScratchTypeSystemClang::GetForTarget(process_sp->GetTarget()); if (!clang_ast_context) return false; diff --git a/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp b/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp index d962f39611b60..a15b0f64954a8 100644 --- a/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp @@ -53,7 +53,7 @@ class NSIndexPathSyntheticFrontEnd : public SyntheticChildrenFrontEnd { if (!type_system) return false; - TypeSystemClang *ast = TypeSystemClang::GetScratch( + TypeSystemClang *ast = ScratchTypeSystemClang::GetForTarget( *m_backend.GetExecutionContextRef().GetTargetSP()); if (!ast) return false; diff --git a/lldb/source/Plugins/Language/ObjC/NSString.cpp b/lldb/source/Plugins/Language/ObjC/NSString.cpp index b9d0d73cbc2eb..85922992eb2ba 100644 --- a/lldb/source/Plugins/Language/ObjC/NSString.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSString.cpp @@ -34,7 +34,7 @@ NSString_Additionals::GetAdditionalSummaries() { static CompilerType GetNSPathStore2Type(Target &target) { static ConstString g_type_name("__lldb_autogen_nspathstore2"); - TypeSystemClang *ast_ctx = TypeSystemClang::GetScratch(target); + TypeSystemClang *ast_ctx = ScratchTypeSystemClang::GetForTarget(target); if (!ast_ctx) return CompilerType(); diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp index 3ab32641d9c1a..6ea9751f563aa 100644 --- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp @@ -536,7 +536,7 @@ ValueObjectSP ItaniumABILanguageRuntime::GetExceptionObjectForThread( return {}; TypeSystemClang *clang_ast_context = - TypeSystemClang::GetScratch(m_process->GetTarget()); + ScratchTypeSystemClang::GetForTarget(m_process->GetTarget()); if (!clang_ast_context) return {}; diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp index 22ea83a57beb7..71cecc0fe8fb5 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp @@ -122,7 +122,8 @@ bool AppleObjCRuntime::GetObjectDescription(Stream &strm, Value &value, } } else { // If it is not a pointer, see if we can make it into a pointer. - TypeSystemClang *ast_context = TypeSystemClang::GetScratch(*target); + TypeSystemClang *ast_context = + ScratchTypeSystemClang::GetForTarget(*target); if (!ast_context) return false; @@ -137,7 +138,7 @@ bool AppleObjCRuntime::GetObjectDescription(Stream &strm, Value &value, arg_value_list.PushValue(value); // This is the return value: - TypeSystemClang *ast_context = TypeSystemClang::GetScratch(*target); + TypeSystemClang *ast_context = ScratchTypeSystemClang::GetForTarget(*target); if (!ast_context) return false; @@ -525,7 +526,7 @@ ThreadSP AppleObjCRuntime::GetBacktraceThreadFromException( return FailExceptionParsing("Failed to get synthetic value."); TypeSystemClang *clang_ast_context = - TypeSystemClang::GetScratch(*exception_sp->GetTargetSP()); + ScratchTypeSystemClang::GetForTarget(*exception_sp->GetTargetSP()); if (!clang_ast_context) return FailExceptionParsing("Failed to get scratch AST."); CompilerType objc_id = diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp index f7247b2fb955e..6afea05c4e745 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -1304,7 +1304,8 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic( return DescriptorMapUpdateResult::Fail(); thread_sp->CalculateExecutionContext(exe_ctx); - TypeSystemClang *ast = TypeSystemClang::GetScratch(process->GetTarget()); + TypeSystemClang *ast = + ScratchTypeSystemClang::GetForTarget(process->GetTarget()); if (!ast) return DescriptorMapUpdateResult::Fail(); @@ -1547,7 +1548,8 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapSharedCache() { return DescriptorMapUpdateResult::Fail(); thread_sp->CalculateExecutionContext(exe_ctx); - TypeSystemClang *ast = TypeSystemClang::GetScratch(process->GetTarget()); + TypeSystemClang *ast = + ScratchTypeSystemClang::GetForTarget(process->GetTarget()); if (!ast) return DescriptorMapUpdateResult::Fail(); @@ -2609,7 +2611,7 @@ class ObjCExceptionRecognizedStackFrame : public RecognizedStackFrame { if (!abi) return; TypeSystemClang *clang_ast_context = - TypeSystemClang::GetScratch(process_sp->GetTarget()); + ScratchTypeSystemClang::GetForTarget(process_sp->GetTarget()); if (!clang_ast_context) return; CompilerType voidstar = diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp index db34ffe518ac4..5c4e3813d5176 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp @@ -521,7 +521,7 @@ bool AppleObjCTrampolineHandler::AppleObjCVTables::RefreshTrampolines( const ABI *abi = process->GetABI().get(); TypeSystemClang *clang_ast_context = - TypeSystemClang::GetScratch(process->GetTarget()); + ScratchTypeSystemClang::GetForTarget(process->GetTarget()); if (!clang_ast_context) return false; @@ -827,8 +827,8 @@ AppleObjCTrampolineHandler::SetupDispatchFunction(Thread &thread, } // Next make the runner function for our implementation utility function. - TypeSystemClang *clang_ast_context = - TypeSystemClang::GetScratch(thread.GetProcess()->GetTarget()); + TypeSystemClang *clang_ast_context = ScratchTypeSystemClang::GetForTarget( + thread.GetProcess()->GetTarget()); if (!clang_ast_context) return LLDB_INVALID_ADDRESS; @@ -931,7 +931,8 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread, TargetSP target_sp(thread.CalculateTarget()); - TypeSystemClang *clang_ast_context = TypeSystemClang::GetScratch(*target_sp); + TypeSystemClang *clang_ast_context = + ScratchTypeSystemClang::GetForTarget(*target_sp); if (!clang_ast_context) return ret_plan_sp; diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp index 47f62a9ca04fc..f717eaa2b47d5 100644 --- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -651,7 +651,8 @@ PlatformPOSIX::MakeLoadImageUtilityFunction(ExecutionContext &exe_ctx, FunctionCaller *do_dlopen_function = nullptr; // Fetch the clang types we will need: - TypeSystemClang *ast = TypeSystemClang::GetScratch(process->GetTarget()); + TypeSystemClang *ast = + ScratchTypeSystemClang::GetForTarget(process->GetTarget()); if (!ast) return nullptr; @@ -895,7 +896,8 @@ uint32_t PlatformPOSIX::DoLoadImage(lldb_private::Process *process, Value return_value; // Fetch the clang types we will need: - TypeSystemClang *ast = TypeSystemClang::GetScratch(process->GetTarget()); + TypeSystemClang *ast = + ScratchTypeSystemClang::GetForTarget(process->GetTarget()); if (!ast) { error.SetErrorString("dlopen error: Unable to get TypeSystemClang"); return LLDB_INVALID_IMAGE_TOKEN; diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp index 16abdd344e3c6..989247bfbb491 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp @@ -216,7 +216,8 @@ 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()); - TypeSystemClang *clang_ast_context = TypeSystemClang::GetScratch(*target_sp); + TypeSystemClang *clang_ast_context = + ScratchTypeSystemClang::GetForTarget(*target_sp); Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); GetItemInfoReturnInfo return_value; diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp index ed5ed278eac6d..7bf158e6efeb6 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp @@ -163,8 +163,8 @@ lldb::addr_t AppleGetPendingItemsHandler::SetupGetPendingItemsFunction( // Next make the runner function for our implementation utility function. Status error; - TypeSystemClang *clang_ast_context = - TypeSystemClang::GetScratch(thread.GetProcess()->GetTarget()); + TypeSystemClang *clang_ast_context = ScratchTypeSystemClang::GetForTarget( + thread.GetProcess()->GetTarget()); CompilerType get_pending_items_return_type = clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType(); get_pending_items_caller = @@ -215,7 +215,8 @@ 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()); - TypeSystemClang *clang_ast_context = TypeSystemClang::GetScratch(*target_sp); + TypeSystemClang *clang_ast_context = + ScratchTypeSystemClang::GetForTarget(*target_sp); Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); GetPendingItemsReturnInfo return_value; diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp index 30490ddb4d4ff..6e652111c2422 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp @@ -180,7 +180,7 @@ AppleGetQueuesHandler::SetupGetQueuesFunction(Thread &thread, // Next make the runner function for our implementation utility function. TypeSystemClang *clang_ast_context = - TypeSystemClang::GetScratch(thread.GetProcess()->GetTarget()); + ScratchTypeSystemClang::GetForTarget(thread.GetProcess()->GetTarget()); CompilerType get_queues_return_type = clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType(); Status error; @@ -220,7 +220,8 @@ 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()); - TypeSystemClang *clang_ast_context = TypeSystemClang::GetScratch(*target_sp); + TypeSystemClang *clang_ast_context = + ScratchTypeSystemClang::GetForTarget(*target_sp); Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); GetQueuesReturnInfo return_value; diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp index b5751db4034c8..77fb0be994d6f 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp @@ -170,8 +170,8 @@ lldb::addr_t AppleGetThreadItemInfoHandler::SetupGetThreadItemInfoFunction( // Also make the FunctionCaller for this UtilityFunction: - TypeSystemClang *clang_ast_context = - TypeSystemClang::GetScratch(thread.GetProcess()->GetTarget()); + TypeSystemClang *clang_ast_context = ScratchTypeSystemClang::GetForTarget( + thread.GetProcess()->GetTarget()); CompilerType get_thread_item_info_return_type = clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType(); @@ -222,7 +222,8 @@ AppleGetThreadItemInfoHandler::GetThreadItemInfo(Thread &thread, lldb::StackFrameSP thread_cur_frame = thread.GetStackFrameAtIndex(0); ProcessSP process_sp(thread.CalculateProcess()); TargetSP target_sp(thread.CalculateTarget()); - TypeSystemClang *clang_ast_context = TypeSystemClang::GetScratch(*target_sp); + TypeSystemClang *clang_ast_context = + ScratchTypeSystemClang::GetForTarget(*target_sp); Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); GetThreadItemInfoReturnInfo return_value; diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp index 33b1ed115e92e..31c2a583db8da 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp @@ -414,7 +414,7 @@ void SystemRuntimeMacOSX::ReadLibdispatchTSDIndexes() { #endif TypeSystemClang *ast_ctx = - TypeSystemClang::GetScratch(m_process->GetTarget()); + ScratchTypeSystemClang::GetForTarget(m_process->GetTarget()); if (m_dispatch_tsd_indexes_addr != LLDB_INVALID_ADDRESS) { CompilerType uint16 = ast_ctx->GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, 16); diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index 0445e4b0a0567..726aaf708c841 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -9585,6 +9585,18 @@ void ScratchTypeSystemClang::Finalize() { m_scratch_ast_source_up.reset(); } +TypeSystemClang *ScratchTypeSystemClang::GetForTarget(Target &target, + bool create_on_demand) { + 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 TypeSystemClang"); + return nullptr; + } + return llvm::dyn_cast<TypeSystemClang>(&type_system_or_err.get()); +} + UserExpression *ScratchTypeSystemClang::GetUserExpression( llvm::StringRef expr, llvm::StringRef prefix, lldb::LanguageType language, Expression::ResultType desired_type, diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h index 15c52b32ba12d..0bfb77af0caa2 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h @@ -156,18 +156,6 @@ class TypeSystemClang : public TypeSystem { static TypeSystemClang *GetASTContext(clang::ASTContext *ast_ctx); - static TypeSystemClang *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 TypeSystemClang"); - return nullptr; - } - return llvm::dyn_cast<TypeSystemClang>(&type_system_or_err.get()); - } - /// Returns the display name of this TypeSystemClang that indicates what /// purpose it serves in LLDB. Used for example in logs. llvm::StringRef getDisplayName() const { return m_display_name; } @@ -1130,6 +1118,16 @@ class ScratchTypeSystemClang : public TypeSystemClang { void Finalize() override; + /// Returns the scratch TypeSystemClang for the given target. + /// \param target The Target which scratch TypeSystemClang should be returned. + /// \param create_on_demand If the scratch TypeSystemClang instance can be + /// created by this call if it doesn't exist yet. If it doesn't exist yet and + /// this parameter is false, this function returns a nullptr. + /// \return The scratch type system of the target or a nullptr in case an + /// error occurred. + static TypeSystemClang *GetForTarget(Target &target, + bool create_on_demand = true); + UserExpression * GetUserExpression(llvm::StringRef expr, llvm::StringRef prefix, lldb::LanguageType language, _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits