diff options
Diffstat (limited to 'lldb/source/Plugins/LanguageRuntime/ObjC')
-rw-r--r-- | lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp | 30 | ||||
-rw-r--r-- | lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h | 4 |
2 files changed, 34 insertions, 0 deletions
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp index b92594b2800..4ff235d1677 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp @@ -269,6 +269,36 @@ AppleObjCRuntime::GetDynamicTypeAndAddress (ValueObject &in_value, return false; } +TypeAndOrName +AppleObjCRuntime::FixUpDynamicType(const TypeAndOrName& type_and_or_name, const CompilerType& static_type) +{ + Flags static_type_flags(static_type.GetTypeInfo()); + + TypeAndOrName ret(type_and_or_name); + if (type_and_or_name.HasType()) + { + // The type will always be the type of the dynamic object. If our parent's type was a pointer, + // then our type should be a pointer to the type of the dynamic object. If a reference, then the original type + // should be okay... + CompilerType orig_type = type_and_or_name.GetCompilerType(); + CompilerType corrected_type = orig_type; + if (static_type_flags.AllSet(eTypeIsPointer)) + corrected_type = orig_type.GetPointerType (); + ret.SetCompilerType(corrected_type); + } + else + { + // If we are here we need to adjust our dynamic type name to include the correct & or * symbol + std::string corrected_name (type_and_or_name.GetName().GetCString()); + if (static_type_flags.AllSet(eTypeIsPointer)) + corrected_name.append(" *"); + // the parent type should be a correctly pointer'ed or referenc'ed type + ret.SetCompilerType(static_type); + ret.SetName(corrected_name.c_str()); + } + return ret; +} + bool AppleObjCRuntime::AppleIsModuleObjCLibrary (const ModuleSP &module_sp) { diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h index dd7019bdcdd..6f4f40b1de8 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h @@ -49,6 +49,10 @@ public: Address &address, Value::ValueType &value_type) override; + TypeAndOrName + FixUpDynamicType(const TypeAndOrName& type_and_or_name, + const CompilerType& static_type) override; + // These are the ObjC specific functions. bool |