summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/LanguageRuntime
diff options
context:
space:
mode:
authorAlex Langford <apl@fb.com>2019-11-14 13:41:52 -0800
committerAlex Langford <apl@fb.com>2019-12-12 11:53:24 -0800
commit3031818a2e9fca1e53cd882ccfcc3718699991b4 (patch)
tree4682f9ca1c9db4b7be7170e3faac6c09b6aa6544 /lldb/source/Plugins/LanguageRuntime
parent7a54f727a2a546ab34df29f48c8e1a10218d74a6 (diff)
downloadbcm5719-llvm-3031818a2e9fca1e53cd882ccfcc3718699991b4.tar.gz
bcm5719-llvm-3031818a2e9fca1e53cd882ccfcc3718699991b4.zip
[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.
Diffstat (limited to 'lldb/source/Plugins/LanguageRuntime')
-rw-r--r--lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp5
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp16
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp14
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp15
4 files changed, 36 insertions, 14 deletions
diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
index 70b0b51f502..9efb021caa8 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
@@ -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();
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
index 8ca9ad7b843..7076959bee9 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -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,
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index 750b6ce6b0c..c2d24edc8e4 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -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;
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
index 379ef3dca86..36f95c063b8 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
@@ -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 =
OpenPOWER on IntegriCloud