diff options
author | Greg Clayton <gclayton@apple.com> | 2015-08-11 21:38:15 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2015-08-11 21:38:15 +0000 |
commit | d8d4a57b37312b62dfa90226293db521e7a4a6fb (patch) | |
tree | ace5d255c1f17af9a9e482ba3e61ed20a05c30c6 /lldb/source/DataFormatters | |
parent | 78046b49a9397db7899a7879e0a88d26f0199025 (diff) | |
download | bcm5719-llvm-d8d4a57b37312b62dfa90226293db521e7a4a6fb.tar.gz bcm5719-llvm-d8d4a57b37312b62dfa90226293db521e7a4a6fb.zip |
First step in getting LLDB ready to support multiple different type systems.
This is the work done by Ryan Brown from http://reviews.llvm.org/D8712 that makes a TypeSystem class and abstracts types to be able to use a type system.
All tests pass on MacOSX and passed on linux the last time this was submitted.
llvm-svn: 244679
Diffstat (limited to 'lldb/source/DataFormatters')
-rw-r--r-- | lldb/source/DataFormatters/CXXFormatterFunctions.cpp | 3 | ||||
-rw-r--r-- | lldb/source/DataFormatters/CoreMedia.cpp | 4 | ||||
-rw-r--r-- | lldb/source/DataFormatters/FormatManager.cpp | 4 | ||||
-rw-r--r-- | lldb/source/DataFormatters/LibCxxInitializerList.cpp | 2 | ||||
-rw-r--r-- | lldb/source/DataFormatters/LibCxxList.cpp | 4 | ||||
-rw-r--r-- | lldb/source/DataFormatters/LibCxxMap.cpp | 2 | ||||
-rw-r--r-- | lldb/source/DataFormatters/LibStdcpp.cpp | 4 | ||||
-rw-r--r-- | lldb/source/DataFormatters/NSArray.cpp | 6 | ||||
-rw-r--r-- | lldb/source/DataFormatters/NSDictionary.cpp | 8 | ||||
-rw-r--r-- | lldb/source/DataFormatters/NSIndexPath.cpp | 5 | ||||
-rw-r--r-- | lldb/source/DataFormatters/VectorType.cpp | 2 |
11 files changed, 25 insertions, 19 deletions
diff --git a/lldb/source/DataFormatters/CXXFormatterFunctions.cpp b/lldb/source/DataFormatters/CXXFormatterFunctions.cpp index 6bf1d56a8ca..73da5ce6004 100644 --- a/lldb/source/DataFormatters/CXXFormatterFunctions.cpp +++ b/lldb/source/DataFormatters/CXXFormatterFunctions.cpp @@ -312,7 +312,8 @@ lldb_private::formatters::WCharStringSummaryProvider (ValueObject& valobj, Strea if (data_addr == 0 || data_addr == LLDB_INVALID_ADDRESS) return false; - clang::ASTContext* ast = valobj.GetClangType().GetASTContext(); + ClangASTContext* lldb_ast = valobj.GetClangType().GetTypeSystem()->AsClangASTContext(); + clang::ASTContext* ast = lldb_ast ? lldb_ast->getASTContext() : nullptr; if (!ast) return false; diff --git a/lldb/source/DataFormatters/CoreMedia.cpp b/lldb/source/DataFormatters/CoreMedia.cpp index 5c33c0b69f7..172bdf07d2c 100644 --- a/lldb/source/DataFormatters/CoreMedia.cpp +++ b/lldb/source/DataFormatters/CoreMedia.cpp @@ -21,7 +21,9 @@ using namespace lldb_private::formatters; bool lldb_private::formatters::CMTimeSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options) { - ClangASTContext *ast_ctx = ClangASTContext::GetASTContext(valobj.GetClangType().GetASTContext()); + if (!valobj.GetClangType().IsValid()) + return false; + ClangASTContext *ast_ctx = valobj.GetClangType().GetTypeSystem()->AsClangASTContext(); if (!ast_ctx) return false; diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp index d10c59b853b..7e9f9b464f7 100644 --- a/lldb/source/DataFormatters/FormatManager.cpp +++ b/lldb/source/DataFormatters/FormatManager.cpp @@ -171,7 +171,7 @@ FormatManager::GetPossibleMatches (ValueObject& valobj, bool did_strip_typedef, bool root_level) { - clang_type = clang_type.RemoveFastQualifiers(); + clang_type = ClangASTContext::RemoveFastQualifiers(clang_type); ConstString type_name(clang_type.GetConstTypeName()); if (valobj.GetBitfieldBitSize() > 0) { @@ -201,7 +201,7 @@ FormatManager::GetPossibleMatches (ValueObject& valobj, if (non_ref_type.IsTypedefType()) { ClangASTType deffed_referenced_type = non_ref_type.GetTypedefedType(); - deffed_referenced_type = is_rvalue_ref ? deffed_referenced_type.GetRValueReferenceType() : deffed_referenced_type.GetLValueReferenceType(); + deffed_referenced_type = is_rvalue_ref ? ClangASTContext::GetRValueReferenceType(deffed_referenced_type) : ClangASTContext::GetLValueReferenceType(deffed_referenced_type); GetPossibleMatches(valobj, deffed_referenced_type, reason | lldb_private::eFormatterChoiceCriterionNavigatedTypedefs, diff --git a/lldb/source/DataFormatters/LibCxxInitializerList.cpp b/lldb/source/DataFormatters/LibCxxInitializerList.cpp index 0dcef981e5e..1f79f00b2b7 100644 --- a/lldb/source/DataFormatters/LibCxxInitializerList.cpp +++ b/lldb/source/DataFormatters/LibCxxInitializerList.cpp @@ -101,7 +101,7 @@ lldb_private::formatters::LibcxxInitializerListSyntheticFrontEnd::Update() m_num_elements = 0; m_children.clear(); lldb::TemplateArgumentKind kind; - m_element_type = m_backend.GetClangType().GetTemplateArgument(0, kind); + m_element_type = ClangASTContext::GetTemplateArgument(m_backend.GetClangType(), 0, kind); if (kind != lldb::eTemplateArgumentKindType || false == m_element_type.IsValid()) return false; diff --git a/lldb/source/DataFormatters/LibCxxList.cpp b/lldb/source/DataFormatters/LibCxxList.cpp index 17e460d0f93..0430a8f9ef4 100644 --- a/lldb/source/DataFormatters/LibCxxList.cpp +++ b/lldb/source/DataFormatters/LibCxxList.cpp @@ -336,10 +336,10 @@ lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::Update() if (list_type.IsReferenceType()) list_type = list_type.GetNonReferenceType(); - if (list_type.GetNumTemplateArguments() == 0) + if (ClangASTContext::GetNumTemplateArguments(list_type) == 0) return false; lldb::TemplateArgumentKind kind; - m_element_type = list_type.GetTemplateArgument(0, kind); + m_element_type = ClangASTContext::GetTemplateArgument(list_type, 0, kind); m_head = impl_sp->GetChildMemberWithName(ConstString("__next_"), true).get(); m_tail = impl_sp->GetChildMemberWithName(ConstString("__prev_"), true).get(); return false; diff --git a/lldb/source/DataFormatters/LibCxxMap.cpp b/lldb/source/DataFormatters/LibCxxMap.cpp index 2ff62328484..2782a3b04e2 100644 --- a/lldb/source/DataFormatters/LibCxxMap.cpp +++ b/lldb/source/DataFormatters/LibCxxMap.cpp @@ -279,7 +279,7 @@ lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::CalculateNumChildren () bool lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::GetDataType() { - if (m_element_type.GetOpaqueQualType() && m_element_type.GetASTContext()) + if (m_element_type.GetOpaqueQualType() && m_element_type.GetTypeSystem()) return true; m_element_type.Clear(); ValueObjectSP deref; diff --git a/lldb/source/DataFormatters/LibStdcpp.cpp b/lldb/source/DataFormatters/LibStdcpp.cpp index 2b3bcb58afa..16ee2c1c391 100644 --- a/lldb/source/DataFormatters/LibStdcpp.cpp +++ b/lldb/source/DataFormatters/LibStdcpp.cpp @@ -79,10 +79,10 @@ lldb_private::formatters::LibstdcppMapIteratorSyntheticFrontEnd::Update() m_pair_address += (is_64bit ? 32 : 16); ClangASTType my_type(valobj_sp->GetClangType()); - if (my_type.GetNumTemplateArguments() >= 1) + if (ClangASTContext::GetNumTemplateArguments(my_type) >= 1) { TemplateArgumentKind kind; - ClangASTType pair_type = my_type.GetTemplateArgument(0, kind); + ClangASTType pair_type = ClangASTContext::GetTemplateArgument(my_type, 0, kind); if (kind != eTemplateArgumentKindType && kind != eTemplateArgumentKindTemplate && kind != eTemplateArgumentKindTemplateExpansion) return false; m_pair_type = pair_type; diff --git a/lldb/source/DataFormatters/NSArray.cpp b/lldb/source/DataFormatters/NSArray.cpp index 640982efdb3..0e665bd3470 100644 --- a/lldb/source/DataFormatters/NSArray.cpp +++ b/lldb/source/DataFormatters/NSArray.cpp @@ -528,11 +528,11 @@ lldb_private::formatters::NSArrayISyntheticFrontEnd::NSArrayISyntheticFrontEnd ( m_items (0), m_data_ptr (0) { - if (valobj_sp) + if (valobj_sp && valobj_sp->GetClangType().IsValid()) { - clang::ASTContext *ast = valobj_sp->GetClangType().GetASTContext(); + ClangASTContext *ast = valobj_sp->GetClangType().GetTypeSystem()->AsClangASTContext(); if (ast) - m_id_type = ClangASTType(ast, ast->ObjCBuiltinIdTy); + m_id_type = ClangASTType(ast->getASTContext(), ast->getASTContext()->ObjCBuiltinIdTy); } } diff --git a/lldb/source/DataFormatters/NSDictionary.cpp b/lldb/source/DataFormatters/NSDictionary.cpp index 30bc3acfbec..30e9d3457e9 100644 --- a/lldb/source/DataFormatters/NSDictionary.cpp +++ b/lldb/source/DataFormatters/NSDictionary.cpp @@ -44,11 +44,11 @@ GetLLDBNSPairType (TargetSP target_sp) if (clang_type) { - clang_type.StartTagDeclarationDefinition(); + ClangASTContext::StartTagDeclarationDefinition(clang_type); ClangASTType id_clang_type = target_ast_context->GetBasicType (eBasicTypeObjCID); - clang_type.AddFieldToRecordType("key", id_clang_type, lldb::eAccessPublic, 0); - clang_type.AddFieldToRecordType("value", id_clang_type, lldb::eAccessPublic, 0); - clang_type.CompleteTagDeclarationDefinition(); + ClangASTContext::AddFieldToRecordType(clang_type, "key", id_clang_type, lldb::eAccessPublic, 0); + ClangASTContext::AddFieldToRecordType(clang_type, "value", id_clang_type, lldb::eAccessPublic, 0); + ClangASTContext::CompleteTagDeclarationDefinition(clang_type); } } } diff --git a/lldb/source/DataFormatters/NSIndexPath.cpp b/lldb/source/DataFormatters/NSIndexPath.cpp index 363bd5c0527..4d6f2c50451 100644 --- a/lldb/source/DataFormatters/NSIndexPath.cpp +++ b/lldb/source/DataFormatters/NSIndexPath.cpp @@ -49,7 +49,10 @@ public: { m_impl.Clear(); - m_ast_ctx = ClangASTContext::GetASTContext(m_backend.GetClangType().GetASTContext()); + TypeSystem* type_system = m_backend.GetClangType().GetTypeSystem(); + if (!type_system) + return false; + m_ast_ctx = type_system->AsClangASTContext(); if (!m_ast_ctx) return false; diff --git a/lldb/source/DataFormatters/VectorType.cpp b/lldb/source/DataFormatters/VectorType.cpp index 316d7b540bc..666e68cc9d1 100644 --- a/lldb/source/DataFormatters/VectorType.cpp +++ b/lldb/source/DataFormatters/VectorType.cpp @@ -232,7 +232,7 @@ namespace lldb_private { ClangASTType parent_type(m_backend.GetClangType()); ClangASTType element_type; parent_type.IsVectorType(&element_type, nullptr); - m_child_type = ::GetClangTypeForFormat(m_parent_format, element_type, ClangASTContext::GetASTContext(parent_type.GetASTContext())); + m_child_type = ::GetClangTypeForFormat(m_parent_format, element_type, parent_type.GetTypeSystem()->AsClangASTContext()); m_num_children = ::CalculateNumChildren(parent_type, m_child_type); m_item_format = GetItemFormatForFormat(m_parent_format, |