summaryrefslogtreecommitdiffstats
path: root/lldb/source/API
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2015-08-24 23:46:31 +0000
committerGreg Clayton <gclayton@apple.com>2015-08-24 23:46:31 +0000
commit99558cc424fee346a4070b42ac9c62546d499333 (patch)
tree3057c0119872e7d5ab68b4571f99ea64eaad1378 /lldb/source/API
parent774b5e296ff49ef15809182440715959f8db674b (diff)
downloadbcm5719-llvm-99558cc424fee346a4070b42ac9c62546d499333.tar.gz
bcm5719-llvm-99558cc424fee346a4070b42ac9c62546d499333.zip
Final bit of type system cleanup that abstracts declaration contexts into lldb_private::CompilerDeclContext and renames ClangType to CompilerType in many accessors and functions.
Create a new "lldb_private::CompilerDeclContext" class that will replace all direct uses of "clang::DeclContext" when used in compiler agnostic code, yet still allow for conversion to clang::DeclContext subclasses by clang specific code. This completes the abstraction of type parsing by removing all "clang::" references from the SymbolFileDWARF. The new "lldb_private::CompilerDeclContext" class abstracts decl contexts found in compiler type systems so they can be used in internal API calls. The TypeSystem is required to support CompilerDeclContexts with new pure virtual functions that start with "DeclContext" in the member function names. Converted all code that used lldb_private::ClangNamespaceDecl over to use the new CompilerDeclContext class and removed the ClangNamespaceDecl.cpp and ClangNamespaceDecl.h files. Removed direct use of clang APIs from SBType and now use the abstract type systems to correctly explore types. Bulk renames for things that used to return a ClangASTType which is now CompilerType: "Type::GetClangFullType()" to "Type::GetFullCompilerType()" "Type::GetClangLayoutType()" to "Type::GetLayoutCompilerType()" "Type::GetClangForwardType()" to "Type::GetForwardCompilerType()" "Value::GetClangType()" to "Value::GetCompilerType()" "Value::SetClangType (const CompilerType &)" to "Value::SetCompilerType (const CompilerType &)" "ValueObject::GetClangType ()" to "ValueObject::GetCompilerType()" many more renames that are similar. llvm-svn: 245905
Diffstat (limited to 'lldb/source/API')
-rw-r--r--lldb/source/API/SBType.cpp55
-rw-r--r--lldb/source/API/SBValue.cpp4
2 files changed, 20 insertions, 39 deletions
diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp
index 0c089f5d47f..ed2a0a74f77 100644
--- a/lldb/source/API/SBType.cpp
+++ b/lldb/source/API/SBType.cpp
@@ -14,10 +14,10 @@
#include "lldb/Core/ConstString.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Stream.h"
-#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/Type.h"
+#include "llvm/ADT/APSInt.h"
#include "clang/AST/Decl.h"
using namespace lldb;
@@ -343,12 +343,7 @@ SBType
SBType::GetBasicType(lldb::BasicType basic_type)
{
if (IsValid() && m_opaque_sp->IsValid())
- {
- ClangASTContext* ast = m_opaque_sp->GetTypeSystem(false)->AsClangASTContext();
- if (ast)
- return SBType (ClangASTContext::GetBasicType (ast->getASTContext(), basic_type));
- }
-
+ return SBType(m_opaque_sp->GetTypeSystem(false)->GetBasicTypeFromAST(basic_type));
return SBType();
}
@@ -356,7 +351,7 @@ uint32_t
SBType::GetNumberOfDirectBaseClasses ()
{
if (IsValid())
- return ClangASTContext::GetNumDirectBaseClasses(m_opaque_sp->GetCompilerType(true));
+ return m_opaque_sp->GetCompilerType(true).GetNumDirectBaseClasses();
return 0;
}
@@ -364,7 +359,7 @@ uint32_t
SBType::GetNumberOfVirtualBaseClasses ()
{
if (IsValid())
- return ClangASTContext::GetNumVirtualBaseClasses(m_opaque_sp->GetCompilerType(true));
+ return m_opaque_sp->GetCompilerType(true).GetNumVirtualBaseClasses();
return 0;
}
@@ -399,16 +394,10 @@ SBType::GetDirectBaseClassAtIndex (uint32_t idx)
SBTypeMember sb_type_member;
if (IsValid())
{
- CompilerType this_type (m_opaque_sp->GetCompilerType (true));
- if (this_type.IsValid())
- {
- uint32_t bit_offset = 0;
- CompilerType base_class_type (ClangASTContext::GetDirectBaseClassAtIndex(this_type, idx, &bit_offset));
- if (base_class_type.IsValid())
- {
- sb_type_member.reset (new TypeMemberImpl (TypeImplSP(new TypeImpl(base_class_type)), bit_offset));
- }
- }
+ uint32_t bit_offset = 0;
+ CompilerType base_class_type = m_opaque_sp->GetCompilerType (true).GetDirectBaseClassAtIndex(idx, &bit_offset);
+ if (base_class_type.IsValid())
+ sb_type_member.reset (new TypeMemberImpl (TypeImplSP(new TypeImpl(base_class_type)), bit_offset));
}
return sb_type_member;
@@ -420,16 +409,10 @@ SBType::GetVirtualBaseClassAtIndex (uint32_t idx)
SBTypeMember sb_type_member;
if (IsValid())
{
- CompilerType this_type (m_opaque_sp->GetCompilerType (true));
- if (this_type.IsValid())
- {
- uint32_t bit_offset = 0;
- CompilerType base_class_type (ClangASTContext::GetVirtualBaseClassAtIndex(this_type, idx, &bit_offset));
- if (base_class_type.IsValid())
- {
- sb_type_member.reset (new TypeMemberImpl (TypeImplSP(new TypeImpl(base_class_type)), bit_offset));
- }
- }
+ uint32_t bit_offset = 0;
+ CompilerType base_class_type = m_opaque_sp->GetCompilerType (true).GetVirtualBaseClassAtIndex(idx, &bit_offset);
+ if (base_class_type.IsValid())
+ sb_type_member.reset (new TypeMemberImpl (TypeImplSP(new TypeImpl(base_class_type)), bit_offset));
}
return sb_type_member;
}
@@ -440,16 +423,14 @@ SBType::GetEnumMembers ()
SBTypeEnumMemberList sb_enum_member_list;
if (IsValid())
{
- const clang::EnumDecl *enum_decl = ClangASTContext::GetAsEnumDecl(m_opaque_sp->GetCompilerType(true).GetFullyUnqualifiedType());
- if (enum_decl)
+ CompilerType this_type (m_opaque_sp->GetCompilerType (true));
+ if (this_type.IsValid())
{
- clang::EnumDecl::enumerator_iterator enum_pos, enum_end_pos;
- for (enum_pos = enum_decl->enumerator_begin(), enum_end_pos = enum_decl->enumerator_end(); enum_pos != enum_end_pos; ++enum_pos)
- {
- SBTypeEnumMember enum_member;
- enum_member.reset(new TypeEnumMemberImpl(*enum_pos, CompilerType(m_opaque_sp->GetTypeSystem(true), enum_decl->getIntegerType().getAsOpaquePtr())));
+ this_type.ForEachEnumerator([&sb_enum_member_list] (const CompilerType &integer_type, const ConstString &name, const llvm::APSInt &value) -> bool {
+ SBTypeEnumMember enum_member (lldb::TypeEnumMemberImplSP (new TypeEnumMemberImpl(lldb::TypeImplSP(new TypeImpl(integer_type)), name, value)));
sb_enum_member_list.Append(enum_member);
- }
+ return true; // Keep iterating
+ });
}
}
return sb_enum_member_list;
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index cd5ba677598..e44488a819c 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -1319,7 +1319,7 @@ SBValue::GetOpaqueType()
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
- return value_sp->GetClangType().GetOpaqueQualType();
+ return value_sp->GetCompilerType().GetOpaqueQualType();
return NULL;
}
@@ -1812,7 +1812,7 @@ SBValue::Watch (bool resolve_location, bool read, bool write, SBError &error)
watch_type |= LLDB_WATCH_TYPE_WRITE;
Error rc;
- CompilerType type (value_sp->GetClangType());
+ CompilerType type (value_sp->GetCompilerType());
WatchpointSP watchpoint_sp = target_sp->CreateWatchpoint(addr, byte_size, &type, watch_type, rc);
error.SetError(rc);
OpenPOWER on IntegriCloud