Index: include/lldb/DataFormatters/FormatClasses.h =================================================================== --- include/lldb/DataFormatters/FormatClasses.h +++ include/lldb/DataFormatters/FormatClasses.h @@ -139,12 +139,6 @@ return nullptr; } - lldb::TypeSP GetTypeSP() { - if (m_type.m_type_pair.IsValid()) - return m_type.m_type_pair.GetTypeSP(); - return lldb::TypeSP(); - } - CompilerType GetCompilerType() { if (m_type.m_type_pair.IsValid()) return m_type.m_type_pair.GetCompilerType(); Index: include/lldb/Symbol/Type.h =================================================================== --- include/lldb/Symbol/Type.h +++ include/lldb/Symbol/Type.h @@ -239,19 +239,16 @@ // these classes are used to back the SBType* objects +// TODO: This class is just a wrapper around CompilerType. Delete it. class TypePair { public: - TypePair() : compiler_type(), type_sp() {} + TypePair() : compiler_type() {} - TypePair(CompilerType type) : compiler_type(type), type_sp() {} + TypePair(CompilerType type) : compiler_type(type) {} - TypePair(lldb::TypeSP type) : compiler_type(), type_sp(type) { - compiler_type = type_sp->GetForwardCompilerType(); - } + TypePair(lldb::TypeSP type) : compiler_type(type->GetForwardCompilerType()) {} - bool IsValid() const { - return compiler_type.IsValid() || (type_sp.get() != nullptr); - } + bool IsValid() const { return compiler_type.IsValid(); } explicit operator bool() const { return IsValid(); } @@ -261,101 +258,58 @@ bool operator!=(const TypePair &rhs) const { return !(*this == rhs); } - void Clear() { - compiler_type.Clear(); - type_sp.reset(); - } + void Clear() { compiler_type.Clear(); } ConstString GetName() const { - if (type_sp) - return type_sp->GetName(); if (compiler_type) return compiler_type.GetTypeName(); return ConstString(); } ConstString GetDisplayTypeName() const { - if (type_sp) - return type_sp->GetForwardCompilerType().GetDisplayTypeName(); if (compiler_type) return compiler_type.GetDisplayTypeName(); return ConstString(); } void SetType(CompilerType type) { - type_sp.reset(); compiler_type = type; } void SetType(lldb::TypeSP type) { - type_sp = type; - if (type_sp) - compiler_type = type_sp->GetForwardCompilerType(); - else - compiler_type.Clear(); + compiler_type = type->GetForwardCompilerType(); } - lldb::TypeSP GetTypeSP() const { return type_sp; } - CompilerType GetCompilerType() const { return compiler_type; } - CompilerType GetPointerType() const { - if (type_sp) - return type_sp->GetForwardCompilerType().GetPointerType(); - return compiler_type.GetPointerType(); - } + CompilerType GetPointerType() const { return compiler_type.GetPointerType(); } - CompilerType GetPointeeType() const { - if (type_sp) - return type_sp->GetForwardCompilerType().GetPointeeType(); - return compiler_type.GetPointeeType(); - } + CompilerType GetPointeeType() const { return compiler_type.GetPointeeType(); } CompilerType GetReferenceType() const { - if (type_sp) - return type_sp->GetForwardCompilerType().GetLValueReferenceType(); - else - return compiler_type.GetLValueReferenceType(); + return compiler_type.GetLValueReferenceType(); } CompilerType GetTypedefedType() const { - if (type_sp) - return type_sp->GetForwardCompilerType().GetTypedefedType(); - else - return compiler_type.GetTypedefedType(); + return compiler_type.GetTypedefedType(); } CompilerType GetDereferencedType() const { - if (type_sp) - return type_sp->GetForwardCompilerType().GetNonReferenceType(); - else - return compiler_type.GetNonReferenceType(); + return compiler_type.GetNonReferenceType(); } CompilerType GetUnqualifiedType() const { - if (type_sp) - return type_sp->GetForwardCompilerType().GetFullyUnqualifiedType(); - else - return compiler_type.GetFullyUnqualifiedType(); + return compiler_type.GetFullyUnqualifiedType(); } CompilerType GetCanonicalType() const { - if (type_sp) - return type_sp->GetForwardCompilerType().GetCanonicalType(); return compiler_type.GetCanonicalType(); } TypeSystem *GetTypeSystem() const { return compiler_type.GetTypeSystem(); } - lldb::ModuleSP GetModule() const { - if (type_sp) - return type_sp->GetModule(); - return lldb::ModuleSP(); - } - protected: CompilerType compiler_type; - lldb::TypeSP type_sp; }; // the two classes here are used by the public API as a backend to the SBType @@ -537,8 +491,6 @@ ConstString GetName() const; - lldb::TypeSP GetTypeSP() const { return m_type_pair.GetTypeSP(); } - CompilerType GetCompilerType() const { return m_type_pair.GetCompilerType(); } void SetName(ConstString type_name); @@ -553,11 +505,9 @@ bool HasName() const; - bool HasTypeSP() const; - bool HasCompilerType() const; - bool HasType() const { return HasTypeSP() || HasCompilerType(); } + bool HasType() const { return HasCompilerType(); } void Clear(); Index: source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp =================================================================== --- source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp +++ source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp @@ -235,16 +235,15 @@ if (!class_type_or_name) return false; - TypeSP type_sp = class_type_or_name.GetTypeSP(); + CompilerType type = class_type_or_name.GetCompilerType(); // There can only be one type with a given name, so we've just found // duplicate definitions, and this one will do as well as any other. We // don't consider something to have a dynamic type if it is the same as // the static type. So compare against the value we were handed. - if (!type_sp) + if (!type) return true; - if (ClangASTContext::AreTypesSame(in_value.GetCompilerType(), - type_sp->GetForwardCompilerType())) { + if (ClangASTContext::AreTypesSame(in_value.GetCompilerType(), type)) { // The dynamic type we found was the same type, so we don't have a // dynamic type here... return false; Index: source/Symbol/Type.cpp =================================================================== --- source/Symbol/Type.cpp +++ source/Symbol/Type.cpp @@ -765,10 +765,6 @@ bool TypeAndOrName::HasName() const { return (bool)m_type_name; } -bool TypeAndOrName::HasTypeSP() const { - return m_type_pair.GetTypeSP().get() != nullptr; -} - bool TypeAndOrName::HasCompilerType() const { return m_type_pair.GetCompilerType().IsValid(); } @@ -832,7 +828,7 @@ } void TypeImpl::SetType(const TypePair &pair, const CompilerType &dynamic) { - m_module_wp = pair.GetModule(); + m_module_wp.reset(); m_static_type = pair; m_dynamic_type = dynamic; }