summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core
diff options
context:
space:
mode:
authorAlex Langford <apl@fb.com>2019-07-12 18:34:37 +0000
committerAlex Langford <apl@fb.com>2019-07-12 18:34:37 +0000
commit24604ec799e03b44c94e2efbc11ca322a22fc49d (patch)
tree7f88c27d203900cc808e372426c22a7cced516e5 /lldb/source/Core
parentcb5ecae1f6fe961d4ec4ed1c0a83ce9e1d0edc11 (diff)
downloadbcm5719-llvm-24604ec799e03b44c94e2efbc11ca322a22fc49d.tar.gz
bcm5719-llvm-24604ec799e03b44c94e2efbc11ca322a22fc49d.zip
[Core] Generalize ValueObject::MaybeCalculateCompleteType
Summary: Instead of hardcoding ClangASTContext and ObjCLanguageRuntime, we can generalize this by creating the method GetRuntimeType in LanguageRuntime and moving the current MaybeCalculateCompleteType implementation into ObjCLanguageruntime::GetRuntimeType Reviewers: jingham, clayborg, JDevlieghere Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D64159 llvm-svn: 365939
Diffstat (limited to 'lldb/source/Core')
-rw-r--r--lldb/source/Core/ValueObject.cpp53
1 files changed, 11 insertions, 42 deletions
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index 73cd1339433..297365b4ecb 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -35,7 +35,6 @@
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Language.h"
#include "lldb/Target/LanguageRuntime.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Target.h"
@@ -280,51 +279,21 @@ CompilerType ValueObject::MaybeCalculateCompleteType() {
return compiler_type;
}
- CompilerType class_type;
- bool is_pointer_type = false;
-
- if (ClangASTContext::IsObjCObjectPointerType(compiler_type, &class_type)) {
- is_pointer_type = true;
- } else if (ClangASTContext::IsObjCObjectOrInterfaceType(compiler_type)) {
- class_type = compiler_type;
- } else {
- return compiler_type;
- }
-
m_did_calculate_complete_objc_class_type = true;
- if (class_type) {
- ConstString class_name(class_type.GetConstTypeName());
-
- if (class_name) {
- ProcessSP process_sp(
- GetUpdatePoint().GetExecutionContextRef().GetProcessSP());
-
- if (process_sp) {
- ObjCLanguageRuntime *objc_language_runtime(
- ObjCLanguageRuntime::Get(*process_sp));
-
- if (objc_language_runtime) {
- TypeSP complete_objc_class_type_sp =
- objc_language_runtime->LookupInCompleteClassCache(class_name);
+ ProcessSP process_sp(
+ GetUpdatePoint().GetExecutionContextRef().GetProcessSP());
- if (complete_objc_class_type_sp) {
- CompilerType complete_class(
- complete_objc_class_type_sp->GetFullCompilerType());
-
- if (complete_class.GetCompleteType()) {
- if (is_pointer_type) {
- m_override_type = complete_class.GetPointerType();
- } else {
- m_override_type = complete_class;
- }
+ if (!process_sp)
+ return compiler_type;
- if (m_override_type.IsValid())
- return m_override_type;
- }
- }
- }
- }
+ if (auto *runtime =
+ process_sp->GetLanguageRuntime(GetObjectRuntimeLanguage())) {
+ if (llvm::Optional<CompilerType> complete_type =
+ runtime->GetRuntimeType(compiler_type)) {
+ m_override_type = complete_type.getValue();
+ if (m_override_type.IsValid())
+ return m_override_type;
}
}
return compiler_type;
OpenPOWER on IntegriCloud