6 changes: 6 additions & 0 deletions lldb/lldb.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,7 @@
9AC703AF117675410086C050 /* SBInstruction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC703AE117675410086C050 /* SBInstruction.cpp */; };
9AC703B1117675490086C050 /* SBInstructionList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC703B0117675490086C050 /* SBInstructionList.cpp */; };
A36FF33C17D8E94600244D40 /* OptionParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A36FF33B17D8E94600244D40 /* OptionParser.cpp */; };
AEEA34051AC88A7400AB639D /* TypeSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AEEA34041AC88A7400AB639D /* TypeSystem.cpp */; };
AF061F87182C97ED00B6A19C /* RegisterContextHistory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF061F85182C97ED00B6A19C /* RegisterContextHistory.cpp */; };
AF061F88182C97ED00B6A19C /* RegisterContextHistory.h in Headers */ = {isa = PBXBuildFile; fileRef = AF061F86182C97ED00B6A19C /* RegisterContextHistory.h */; };
AF061F8B182C980000B6A19C /* HistoryThread.h in Headers */ = {isa = PBXBuildFile; fileRef = AF061F89182C980000B6A19C /* HistoryThread.h */; };
Expand Down Expand Up @@ -2661,6 +2662,8 @@
9AF16CC7114086A1007A7B3F /* SBBreakpointLocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBBreakpointLocation.cpp; path = source/API/SBBreakpointLocation.cpp; sourceTree = "<group>"; };
A36FF33B17D8E94600244D40 /* OptionParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OptionParser.cpp; sourceTree = "<group>"; };
A36FF33D17D8E98800244D40 /* OptionParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OptionParser.h; path = include/lldb/Host/OptionParser.h; sourceTree = "<group>"; };
AEEA33F61AC74FE700AB639D /* TypeSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TypeSystem.h; path = include/lldb/Symbol/TypeSystem.h; sourceTree = "<group>"; };
AEEA34041AC88A7400AB639D /* TypeSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TypeSystem.cpp; path = source/Symbol/TypeSystem.cpp; sourceTree = "<group>"; };
AF061F85182C97ED00B6A19C /* RegisterContextHistory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegisterContextHistory.cpp; path = Utility/RegisterContextHistory.cpp; sourceTree = "<group>"; };
AF061F86182C97ED00B6A19C /* RegisterContextHistory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegisterContextHistory.h; path = Utility/RegisterContextHistory.h; sourceTree = "<group>"; };
AF061F89182C980000B6A19C /* HistoryThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HistoryThread.h; path = Utility/HistoryThread.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -4232,6 +4235,8 @@
26BC7F2010F1B8EC00F91463 /* Type.cpp */,
26BC7C6610F1B6E900F91463 /* TypeList.h */,
26BC7F2110F1B8EC00F91463 /* TypeList.cpp */,
AEEA33F61AC74FE700AB639D /* TypeSystem.h */,
AEEA34041AC88A7400AB639D /* TypeSystem.cpp */,
269FF07F12494F8E00225026 /* UnwindPlan.h */,
961FABB91235DE1600F93A47 /* UnwindPlan.cpp */,
269FF08112494FC200225026 /* UnwindTable.h */,
Expand Down Expand Up @@ -6278,6 +6283,7 @@
2689009F13353E4200698AC0 /* ProcessGDBRemote.cpp in Sources */,
268900A013353E4200698AC0 /* ProcessGDBRemoteLog.cpp in Sources */,
268900A113353E4200698AC0 /* ThreadGDBRemote.cpp in Sources */,
AEEA34051AC88A7400AB639D /* TypeSystem.cpp in Sources */,
AF1729D6182C907200E0AB97 /* HistoryThread.cpp in Sources */,
268900AF13353E5000698AC0 /* UnwindLLDB.cpp in Sources */,
268900B013353E5000698AC0 /* RegisterContextLLDB.cpp in Sources */,
Expand Down
29 changes: 17 additions & 12 deletions lldb/source/API/SBType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ SBType::SBType() :
}

SBType::SBType (const ClangASTType &type) :
m_opaque_sp(new TypeImpl(ClangASTType(type.GetASTContext(),
m_opaque_sp(new TypeImpl(ClangASTType(type.GetTypeSystem(),
type.GetOpaqueQualType())))
{
}
Expand Down Expand Up @@ -342,24 +342,29 @@ SBType::GetBasicType()
SBType
SBType::GetBasicType(lldb::BasicType basic_type)
{
if (IsValid())
return SBType (ClangASTContext::GetBasicType (m_opaque_sp->GetClangASTContext(false), 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();
}

uint32_t
SBType::GetNumberOfDirectBaseClasses ()
{
if (IsValid())
return m_opaque_sp->GetClangASTType(true).GetNumDirectBaseClasses();
return ClangASTContext::GetNumDirectBaseClasses(m_opaque_sp->GetClangASTType(true));
return 0;
}

uint32_t
SBType::GetNumberOfVirtualBaseClasses ()
{
if (IsValid())
return m_opaque_sp->GetClangASTType(true).GetNumVirtualBaseClasses();
return ClangASTContext::GetNumVirtualBaseClasses(m_opaque_sp->GetClangASTType(true));
return 0;
}

Expand Down Expand Up @@ -398,7 +403,7 @@ SBType::GetDirectBaseClassAtIndex (uint32_t idx)
if (this_type.IsValid())
{
uint32_t bit_offset = 0;
ClangASTType base_class_type (this_type.GetDirectBaseClassAtIndex(idx, &bit_offset));
ClangASTType 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));
Expand All @@ -419,7 +424,7 @@ SBType::GetVirtualBaseClassAtIndex (uint32_t idx)
if (this_type.IsValid())
{
uint32_t bit_offset = 0;
ClangASTType base_class_type (this_type.GetVirtualBaseClassAtIndex(idx, &bit_offset));
ClangASTType 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));
Expand All @@ -435,14 +440,14 @@ SBType::GetEnumMembers ()
SBTypeEnumMemberList sb_enum_member_list;
if (IsValid())
{
const clang::EnumDecl *enum_decl = m_opaque_sp->GetClangASTType(true).GetFullyUnqualifiedType().GetAsEnumDecl();
const clang::EnumDecl *enum_decl = ClangASTContext::GetAsEnumDecl(m_opaque_sp->GetClangASTType(true).GetFullyUnqualifiedType());
if (enum_decl)
{
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, ClangASTType(m_opaque_sp->GetClangASTContext(true), enum_decl->getIntegerType())));
enum_member.reset(new TypeEnumMemberImpl(*enum_pos, ClangASTType(m_opaque_sp->GetTypeSystem(true), enum_decl->getIntegerType().getAsOpaquePtr())));
sb_enum_member_list.Append(enum_member);
}
}
Expand Down Expand Up @@ -528,7 +533,7 @@ uint32_t
SBType::GetNumberOfTemplateArguments ()
{
if (IsValid())
return m_opaque_sp->GetClangASTType(false).GetNumTemplateArguments();
return ClangASTContext::GetNumTemplateArguments(m_opaque_sp->GetClangASTType(false));
return 0;
}

Expand All @@ -538,7 +543,7 @@ SBType::GetTemplateArgumentType (uint32_t idx)
if (IsValid())
{
TemplateArgumentKind kind = eTemplateArgumentKindNull;
ClangASTType template_arg_type = m_opaque_sp->GetClangASTType(false).GetTemplateArgument (idx, kind);
ClangASTType template_arg_type = ClangASTContext::GetTemplateArgument(m_opaque_sp->GetClangASTType(false), idx, kind);
if (template_arg_type.IsValid())
return SBType(template_arg_type);
}
Expand All @@ -551,7 +556,7 @@ SBType::GetTemplateArgumentKind (uint32_t idx)
{
TemplateArgumentKind kind = eTemplateArgumentKindNull;
if (IsValid())
m_opaque_sp->GetClangASTType(false).GetTemplateArgument (idx, kind);
ClangASTContext::GetTemplateArgument(m_opaque_sp->GetClangASTType(false), idx, kind);
return kind;
}

Expand Down
3 changes: 2 additions & 1 deletion lldb/source/Commands/CommandObjectMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "lldb/Interpreter/OptionGroupOutputFile.h"
#include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
#include "lldb/Interpreter/OptionValueString.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/TypeList.h"
#include "lldb/Target/MemoryHistory.h"
#include "lldb/Target/Process.h"
Expand Down Expand Up @@ -532,7 +533,7 @@ class CommandObjectMemoryRead : public CommandObjectParsed
clang::TypeDecl *tdecl = target->GetPersistentVariables().GetPersistentType(ConstString(lookup_type_name));
if (tdecl)
{
clang_ast_type.SetClangType(&tdecl->getASTContext(),(const lldb::clang_type_t)tdecl->getTypeForDecl());
clang_ast_type.SetClangType(ClangASTContext::GetASTContext(&tdecl->getASTContext()),(const lldb::clang_type_t)tdecl->getTypeForDecl());
}
}

Expand Down
6 changes: 3 additions & 3 deletions lldb/source/Core/ValueObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,11 @@ ValueObject::MaybeCalculateCompleteType ()
ClangASTType class_type;
bool is_pointer_type = false;

if (clang_type.IsObjCObjectPointerType(&class_type))
if (ClangASTContext::IsObjCObjectPointerType(clang_type, &class_type))
{
is_pointer_type = true;
}
else if (clang_type.IsObjCObjectOrInterfaceType())
else if (ClangASTContext::IsObjCObjectOrInterfaceType(clang_type))
{
class_type = clang_type;
}
Expand Down Expand Up @@ -2419,7 +2419,7 @@ ValueObject::GetBaseClassPath (Stream &s)
bool parent_had_base_class = GetParent() && GetParent()->GetBaseClassPath (s);
ClangASTType clang_type = GetClangType();
std::string cxx_class_name;
bool this_had_base_class = clang_type.GetCXXClassName (cxx_class_name);
bool this_had_base_class = ClangASTContext::GetCXXClassName (clang_type, cxx_class_name);
if (this_had_base_class)
{
if (parent_had_base_class)
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Core/ValueObjectDynamicValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ FixupTypeAndOrName (const TypeAndOrName& type_andor_name,
if (parent.IsPointerType())
corrected_type = orig_type.GetPointerType ();
else if (parent.IsPointerOrReferenceType())
corrected_type = orig_type.GetLValueReferenceType ();
corrected_type = ClangASTContext::GetLValueReferenceType(orig_type);
ret.SetClangASTType(corrected_type);
}
else /*if (m_dynamic_type_info.HasName())*/
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Core/ValueObjectMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ ValueObjectMemory::ValueObjectMemory (ExecutionContextScope *exe_scope,
m_clang_type(ast_type)
{
// Do not attempt to construct one of these objects with no variable!
assert (m_clang_type.GetASTContext());
assert (m_clang_type.GetTypeSystem());
assert (m_clang_type.GetOpaqueQualType());

TargetSP target_sp (GetTargetSP());
Expand Down
3 changes: 2 additions & 1 deletion lldb/source/DataFormatters/CXXFormatterFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion lldb/source/DataFormatters/CoreMedia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions lldb/source/DataFormatters/FormatManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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::GetRValueReferenceType(deffed_referenced_type);
GetPossibleMatches(valobj,
deffed_referenced_type,
reason | lldb_private::eFormatterChoiceCriterionNavigatedTypedefs,
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/DataFormatters/LibCxxInitializerList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions lldb/source/DataFormatters/LibCxxList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,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;
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/DataFormatters/LibCxxMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions lldb/source/DataFormatters/LibStdcpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions lldb/source/DataFormatters/NSArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
8 changes: 4 additions & 4 deletions lldb/source/DataFormatters/NSDictionary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion lldb/source/DataFormatters/NSIndexPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ class NSIndexPathSyntheticFrontEnd : public SyntheticChildrenFrontEnd
{
m_impl.m_mode = Mode::Invalid;

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;

Expand Down
2 changes: 1 addition & 1 deletion lldb/source/DataFormatters/VectorType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,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,
Expand Down
3 changes: 2 additions & 1 deletion lldb/source/Expression/ASTDumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "lldb/Core/Log.h"
#include "lldb/Expression/ASTDumper.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/ClangASTType.h"

#include "llvm/Support/raw_ostream.h"
Expand Down Expand Up @@ -81,7 +82,7 @@ ASTDumper::ASTDumper (lldb::clang_type_t type)

ASTDumper::ASTDumper (const ClangASTType &clang_type)
{
m_dump = clang_type.GetQualType().getAsString();
m_dump = ClangASTContext::GetQualType(clang_type).getAsString();
}


Expand Down
28 changes: 20 additions & 8 deletions lldb/source/Expression/ClangASTSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ ClangASTSource::CompleteType (TagDecl *tag_decl)
if (!clang_type)
continue;

const TagType *tag_type = clang_type.GetQualType()->getAs<TagType>();
const TagType *tag_type = ClangASTContext::GetQualType(clang_type)->getAs<TagType>();

if (!tag_type)
continue;
Expand Down Expand Up @@ -316,7 +316,7 @@ ClangASTSource::CompleteType (TagDecl *tag_decl)
if (!clang_type)
continue;

const TagType *tag_type = clang_type.GetQualType()->getAs<TagType>();
const TagType *tag_type = ClangASTContext::GetQualType(clang_type)->getAs<TagType>();

if (!tag_type)
continue;
Expand Down Expand Up @@ -1886,9 +1886,13 @@ ClangASTSource::GuardedCopyType (const ClangASTType &src_type)
{
ClangASTMetrics::RegisterLLDBImport();

ClangASTContext* src_ast = src_type.GetTypeSystem()->AsClangASTContext();
if (!src_ast)
return ClangASTType();

SetImportInProgress(true);

QualType copied_qual_type = m_ast_importer->CopyType (m_ast_context, src_type.GetASTContext(), src_type.GetQualType());
QualType copied_qual_type = m_ast_importer->CopyType (m_ast_context, src_ast->getASTContext(), ClangASTContext::GetQualType(src_type));

SetImportInProgress(false);

Expand All @@ -1908,16 +1912,20 @@ NameSearchContext::AddVarDecl(const ClangASTType &type)
if (!type.IsValid())
return NULL;

ClangASTContext* lldb_ast = type.GetTypeSystem()->AsClangASTContext();
if (!lldb_ast)
return NULL;

IdentifierInfo *ii = m_decl_name.getAsIdentifierInfo();

clang::ASTContext *ast = type.GetASTContext();
clang::ASTContext *ast = lldb_ast->getASTContext();

clang::NamedDecl *Decl = VarDecl::Create(*ast,
const_cast<DeclContext*>(m_decl_context),
SourceLocation(),
SourceLocation(),
ii,
type.GetQualType(),
ClangASTContext::GetQualType(type),
0,
SC_Static);
m_decls.push_back(Decl);
Expand All @@ -1935,12 +1943,16 @@ NameSearchContext::AddFunDecl (const ClangASTType &type, bool extern_c)

if (m_function_types.count(type))
return NULL;

ClangASTContext* lldb_ast = type.GetTypeSystem()->AsClangASTContext();
if (!lldb_ast)
return NULL;

m_function_types.insert(type);

QualType qual_type (type.GetQualType());
QualType qual_type (ClangASTContext::GetQualType(type));

clang::ASTContext *ast = type.GetASTContext();
clang::ASTContext *ast = lldb_ast->getASTContext();

const bool isInlineSpecified = false;
const bool hasWrittenPrototype = true;
Expand Down Expand Up @@ -2031,7 +2043,7 @@ NameSearchContext::AddTypeDecl(const ClangASTType &clang_type)
{
if (clang_type)
{
QualType qual_type = clang_type.GetQualType();
QualType qual_type = ClangASTContext::GetQualType(clang_type);

if (const TypedefType *typedef_type = llvm::dyn_cast<TypedefType>(qual_type))
{
Expand Down
60 changes: 31 additions & 29 deletions lldb/source/Expression/ClangExpressionDeclMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,10 @@ ClangExpressionDeclMap::AddPersistentVariable
if (target == NULL)
return false;

ASTContext *context(target->GetScratchClangASTContext()->getASTContext());
ClangASTContext *context(target->GetScratchClangASTContext());

TypeFromUser user_type(m_ast_importer->DeportType(context,
parser_type.GetASTContext(),
TypeFromUser user_type(m_ast_importer->DeportType(context->getASTContext(),
parser_type.GetTypeSystem()->AsClangASTContext()->getASTContext(),
parser_type.GetOpaqueQualType()),
context);

Expand Down Expand Up @@ -241,10 +241,10 @@ ClangExpressionDeclMap::AddPersistentVariable
if (target == NULL)
return false;

ASTContext *context(target->GetScratchClangASTContext()->getASTContext());
ClangASTContext *context(target->GetScratchClangASTContext());

TypeFromUser user_type(m_ast_importer->DeportType(context,
parser_type.GetASTContext(),
TypeFromUser user_type(m_ast_importer->DeportType(context->getASTContext(),
parser_type.GetTypeSystem()->AsClangASTContext()->getASTContext(),
parser_type.GetOpaqueQualType()),
context);

Expand Down Expand Up @@ -1041,7 +1041,7 @@ ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context,
QualType class_qual_type(class_decl->getTypeForDecl(), 0);

TypeFromUser class_user_type (class_qual_type.getAsOpaquePtr(),
&class_decl->getASTContext());
ClangASTContext::GetASTContext(&class_decl->getASTContext()));

if (log)
{
Expand Down Expand Up @@ -1079,7 +1079,7 @@ ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context,
QualType class_pointer_type = method_decl->getASTContext().getPointerType(class_qual_type);

TypeFromUser self_user_type(class_pointer_type.getAsOpaquePtr(),
&method_decl->getASTContext());
ClangASTContext::GetASTContext(&method_decl->getASTContext()));

m_struct_vars->m_object_pointer_type = self_user_type;
}
Expand Down Expand Up @@ -1169,7 +1169,7 @@ ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context,
return; // This is unlikely, but we have seen crashes where this occurred

TypeFromUser class_user_type(QualType(interface_type, 0).getAsOpaquePtr(),
&method_decl->getASTContext());
ClangASTContext::GetASTContext(&method_decl->getASTContext()));

if (log)
{
Expand All @@ -1186,7 +1186,7 @@ ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context,
QualType class_pointer_type = method_decl->getASTContext().getObjCObjectPointerType(QualType(interface_type, 0));

TypeFromUser self_user_type(class_pointer_type.getAsOpaquePtr(),
&method_decl->getASTContext());
ClangASTContext::GetASTContext(&method_decl->getASTContext()));

m_struct_vars->m_object_pointer_type = self_user_type;
}
Expand All @@ -1196,7 +1196,7 @@ ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context,
QualType class_type = method_decl->getASTContext().getObjCClassType();

TypeFromUser self_user_type(class_type.getAsOpaquePtr(),
&method_decl->getASTContext());
ClangASTContext::GetASTContext(&method_decl->getASTContext()));

m_struct_vars->m_object_pointer_type = self_user_type;
}
Expand Down Expand Up @@ -1225,11 +1225,11 @@ ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context,

ClangASTType self_clang_type = self_type->GetClangFullType();

if (self_clang_type.IsObjCClassType())
if (ClangASTContext::IsObjCClassType(self_clang_type))
{
return;
}
else if (self_clang_type.IsObjCObjectPointerType())
else if (ClangASTContext::IsObjCObjectPointerType(self_clang_type))
{
self_clang_type = self_clang_type.GetPointeeType();

Expand Down Expand Up @@ -1726,7 +1726,7 @@ ClangExpressionDeclMap::AddOneVariable (NameSearchContext &context, VariableSP v
if (is_reference)
var_decl = context.AddVarDecl(pt);
else
var_decl = context.AddVarDecl(pt.GetLValueReferenceType());
var_decl = context.AddVarDecl(ClangASTContext::GetLValueReferenceType(pt));

std::string decl_name(context.m_decl_name.getAsString());
ConstString entity_name(decl_name.c_str());
Expand Down Expand Up @@ -1770,7 +1770,7 @@ ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context,
return;
}

NamedDecl *var_decl = context.AddVarDecl(parser_type.GetLValueReferenceType());
NamedDecl *var_decl = context.AddVarDecl(ClangASTContext::GetLValueReferenceType(parser_type));

pvar_sp->EnableParserVars(GetParserID());
ClangExpressionVariable::ParserVars *parser_vars = pvar_sp->GetParserVars(GetParserID());
Expand Down Expand Up @@ -1802,8 +1802,8 @@ ClangExpressionDeclMap::AddOneGenericVariable(NameSearchContext &context,

ASTContext *scratch_ast_context = target->GetScratchClangASTContext()->getASTContext();

TypeFromUser user_type (ClangASTContext::GetBasicType(scratch_ast_context, eBasicTypeVoid).GetPointerType().GetLValueReferenceType());
TypeFromParser parser_type (ClangASTContext::GetBasicType(m_ast_context, eBasicTypeVoid).GetPointerType().GetLValueReferenceType());
TypeFromUser user_type (ClangASTContext::GetLValueReferenceType(ClangASTContext::GetBasicType(scratch_ast_context, eBasicTypeVoid).GetPointerType()));
TypeFromParser parser_type (ClangASTContext::GetLValueReferenceType(ClangASTContext::GetBasicType(m_ast_context, eBasicTypeVoid).GetPointerType()));
NamedDecl *var_decl = context.AddVarDecl(parser_type);

std::string decl_name(context.m_decl_name.getAsString());
Expand Down Expand Up @@ -1845,7 +1845,7 @@ ClangExpressionDeclMap::ResolveUnknownTypes()
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr();

ASTContext *scratch_ast_context = target->GetScratchClangASTContext()->getASTContext();
ClangASTContext *scratch_ast_context = target->GetScratchClangASTContext();

for (size_t index = 0, num_entities = m_found_entities.GetSize();
index < num_entities;
Expand Down Expand Up @@ -1874,9 +1874,9 @@ ClangExpressionDeclMap::ResolveUnknownTypes()
}

QualType var_type = var_decl->getType();
TypeFromParser parser_type(var_type.getAsOpaquePtr(), &var_decl->getASTContext());
TypeFromParser parser_type(var_type.getAsOpaquePtr(), ClangASTContext::GetASTContext(&var_decl->getASTContext()));

lldb::clang_type_t copied_type = m_ast_importer->CopyType(scratch_ast_context, &var_decl->getASTContext(), var_type.getAsOpaquePtr());
lldb::clang_type_t copied_type = m_ast_importer->CopyType(scratch_ast_context->getASTContext(), &var_decl->getASTContext(), var_type.getAsOpaquePtr());

if (!copied_type)
{
Expand Down Expand Up @@ -2114,15 +2114,17 @@ ClangExpressionDeclMap::CopyClassType(TypeFromUser &ut,
const bool is_attr_used = true;
const bool is_artificial = false;

copied_clang_type.AddMethodToCXXRecordType ("$__lldb_expr",
method_type,
lldb::eAccessPublic,
is_virtual,
is_static,
is_inline,
is_explicit,
is_attr_used,
is_artificial);
ClangASTContext::GetASTContext(m_ast_context)->
AddMethodToCXXRecordType (copied_clang_type.GetOpaqueQualType(),
"$__lldb_expr",
method_type,
lldb::eAccessPublic,
is_virtual,
is_static,
is_inline,
is_explicit,
is_attr_used,
is_artificial);
}

return TypeFromParser(copied_clang_type);
Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Expression/ClangUserExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,11 @@ ClangUserExpression::ScanContext(ExecutionContext &exe_ctx, Error &err)
return;
}

if (self_clang_type.IsObjCClassType())
if (ClangASTContext::IsObjCClassType(self_clang_type))
{
return;
}
else if (self_clang_type.IsObjCObjectPointerType())
else if (ClangASTContext::IsObjCObjectPointerType(self_clang_type))
{
m_objectivec = true;
m_needs_object_ptr = true;
Expand Down
10 changes: 5 additions & 5 deletions lldb/source/Expression/IRForTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,14 +575,14 @@ IRForTarget::CreateResultVariable (llvm::Function &llvm_function)
clang::QualType element_qual_type = pointer_pointertype->getPointeeType();

m_result_type = lldb_private::TypeFromParser(element_qual_type.getAsOpaquePtr(),
&result_decl->getASTContext());
lldb_private::ClangASTContext::GetASTContext(&result_decl->getASTContext()));
}
else if (pointer_objcobjpointertype)
{
clang::QualType element_qual_type = clang::QualType(pointer_objcobjpointertype->getObjectType(), 0);

m_result_type = lldb_private::TypeFromParser(element_qual_type.getAsOpaquePtr(),
&result_decl->getASTContext());
lldb_private::ClangASTContext::GetASTContext(&result_decl->getASTContext()));
}
else
{
Expand All @@ -598,7 +598,7 @@ IRForTarget::CreateResultVariable (llvm::Function &llvm_function)
else
{
m_result_type = lldb_private::TypeFromParser(result_var->getType().getAsOpaquePtr(),
&result_decl->getASTContext());
lldb_private::ClangASTContext::GetASTContext(&result_decl->getASTContext()));
}


Expand Down Expand Up @@ -1241,7 +1241,7 @@ IRForTarget::RewritePersistentAlloc (llvm::Instruction *persistent_alloc)
clang::VarDecl *decl = reinterpret_cast<clang::VarDecl *>(ptr);

lldb_private::TypeFromParser result_decl_type (decl->getType().getAsOpaquePtr(),
&decl->getASTContext());
lldb_private::ClangASTContext::GetASTContext(&decl->getASTContext()));

StringRef decl_name (decl->getName());
lldb_private::ConstString persistent_variable_name (decl_name.data(), decl_name.size());
Expand Down Expand Up @@ -1539,7 +1539,7 @@ IRForTarget::MaybeHandleVariable (Value *llvm_value_ptr)
{
log->Printf("Type of \"%s\" is [clang \"%s\", llvm \"%s\"] [size %" PRIu64 ", align %" PRIu64 "]",
name.c_str(),
clang_type.GetQualType().getAsString().c_str(),
lldb_private::ClangASTContext::GetQualType(clang_type).getAsString().c_str(),
PrintType(value_type).c_str(),
value_size,
value_alignment);
Expand Down
3 changes: 2 additions & 1 deletion lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,8 @@ ABIMacOSX_arm::GetReturnValueObjectImpl (Thread &thread,
if (!clang_type)
return return_valobj_sp;

clang::ASTContext *ast_context = clang_type.GetASTContext();
ClangASTContext* ast = clang_type.GetTypeSystem()->AsClangASTContext();
clang::ASTContext *ast_context = ast ? ast->getASTContext() : nullptr;
if (!ast_context)
return return_valobj_sp;

Expand Down
4 changes: 0 additions & 4 deletions lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,6 @@ ABISysV_arm::GetReturnValueObjectImpl (Thread &thread,
if (!clang_type)
return return_valobj_sp;

clang::ASTContext *ast_context = clang_type.GetASTContext();
if (!ast_context)
return return_valobj_sp;

//value.SetContext (Value::eContextTypeClangType, clang_type.GetOpaqueQualType());
value.SetClangType (clang_type);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ ItaniumABILanguageRuntime::GetDynamicTypeAndAddress (ValueObject &in_value,
type_sp = class_types.GetTypeAtIndex(i);
if (type_sp)
{
if (type_sp->GetClangFullType().IsCXXClassType())
if (ClangASTContext::IsCXXClassType(type_sp->GetClangFullType()))
{
if (log)
log->Printf ("0x%16.16" PRIx64 ": static-type = '%s' has multiple matching dynamic types, picking this one: uid={0x%" PRIx64 "}, type-name='%s'\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ class ObjCRuntimeMethodType

clang::Selector sel = ast_ctx.Selectors.getSelector(is_zero_argument ? 0 : selector_components.size(), selector_components.data());

clang::QualType ret_type = type_realizer_sp->RealizeType(interface_decl->getASTContext(), m_type_vector[0].c_str(), for_expression).GetQualType();
clang::QualType ret_type = ClangASTContext::GetQualType(type_realizer_sp->RealizeType(interface_decl->getASTContext(), m_type_vector[0].c_str(), for_expression));

if (ret_type.isNull())
return NULL;
Expand All @@ -390,7 +390,7 @@ class ObjCRuntimeMethodType
++ai)
{
const bool for_expression = true;
clang::QualType arg_type = type_realizer_sp->RealizeType(ast_ctx, m_type_vector[ai].c_str(), for_expression).GetQualType();
clang::QualType arg_type = ClangASTContext::GetQualType(type_realizer_sp->RealizeType(ast_ctx, m_type_vector[ai].c_str(), for_expression));

if (arg_type.isNull())
return NULL; // well, we just wasted a bunch of time. Wish we could delete the stuff we'd just made!
Expand Down Expand Up @@ -512,7 +512,7 @@ AppleObjCDeclVendor::FinishDecl(clang::ObjCInterfaceDecl *interface_decl)
clang::SourceLocation(),
clang::SourceLocation(),
&m_ast_ctx.getASTContext()->Idents.get(name),
ivar_type.GetQualType(),
ClangASTContext::GetQualType(ivar_type),
type_source_info, // TypeSourceInfo *
clang::ObjCIvarDecl::Public,
0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ AppleObjCRuntime::GetObjectDescription (Stream &strm, Value &value, ExecutionCon
ClangASTType clang_type = value.GetClangType();
if (clang_type)
{
if (!clang_type.IsObjCObjectPointerType())
if (!ClangASTContext::IsObjCObjectPointerType(clang_type))
{
strm.Printf ("Value doesn't point to an ObjC object.\n");
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ AppleObjCTypeEncodingParser::BuildAggregate (clang::ASTContext &ast_ctx, lldb_ut
ClangASTType union_type(lldb_ctx->CreateRecordType(nullptr, lldb::eAccessPublic, name.c_str(), kind, lldb::eLanguageTypeC));
if (union_type)
{
union_type.StartTagDeclarationDefinition();
ClangASTContext::StartTagDeclarationDefinition(union_type);

unsigned int count = 0;
for (auto element: elements)
Expand All @@ -150,13 +150,12 @@ AppleObjCTypeEncodingParser::BuildAggregate (clang::ASTContext &ast_ctx, lldb_ut
elem_name.Printf("__unnamed_%u",count);
element.name = std::string(elem_name.GetData());
}
union_type.AddFieldToRecordType(element.name.c_str(), ClangASTType(&ast_ctx,element.type.getAsOpaquePtr()), lldb::eAccessPublic, element.bitfield);
ClangASTContext::AddFieldToRecordType(union_type, element.name.c_str(), ClangASTType(&ast_ctx, element.type), lldb::eAccessPublic, element.bitfield);
++count;
}

union_type.CompleteTagDeclarationDefinition();
ClangASTContext::CompleteTagDeclarationDefinition(union_type);
}
return union_type.GetQualType();
return ClangASTContext::GetQualType(union_type);
}

clang::QualType
Expand All @@ -171,8 +170,8 @@ AppleObjCTypeEncodingParser::BuildArray (clang::ASTContext &ast_ctx, lldb_utilit
ClangASTContext *lldb_ctx = ClangASTContext::GetASTContext(&ast_ctx);
if (!lldb_ctx)
return clang::QualType();
ClangASTType array_type(lldb_ctx->CreateArrayType(ClangASTType(&ast_ctx,element_type.getAsOpaquePtr()), size, false));
return array_type.GetQualType();
ClangASTType array_type(lldb_ctx->CreateArrayType(ClangASTType(&ast_ctx, element_type), size, false));
return ClangASTContext::GetQualType(array_type);
}

// the runtime can emit these in the form of @"SomeType", giving more specifics
Expand Down Expand Up @@ -263,7 +262,7 @@ AppleObjCTypeEncodingParser::BuildObjCObjectPointerType (clang::ASTContext &ast_
return ast_ctx.getObjCIdType();
#endif

return ClangASTContext::GetTypeForDecl(decls[0]).GetPointerType().GetQualType();
return ClangASTContext::GetQualType(ClangASTContext::GetTypeForDecl(decls[0]).GetPointerType());
}
else
{
Expand Down Expand Up @@ -392,7 +391,7 @@ AppleObjCTypeEncodingParser::RealizeType (clang::ASTContext &ast_ctx, const char
{
StringLexer lexer(name);
clang::QualType qual_type = BuildType(ast_ctx, lexer, for_expression);
return ClangASTType(&ast_ctx, qual_type.getAsOpaquePtr());
return ClangASTType(&ast_ctx, qual_type);
}
return ClangASTType();
}
Expand Down
182 changes: 105 additions & 77 deletions lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,12 +448,13 @@ SystemRuntimeMacOSX::ReadLibdispatchTSDIndexes ()
{
ClangASTType uint16 = ast_ctx->GetIntTypeFromBitSize(16, false);
ClangASTType dispatch_tsd_indexes_s = ast_ctx->CreateRecordType(nullptr, lldb::eAccessPublic, "__lldb_dispatch_tsd_indexes_s", clang::TTK_Struct, lldb::eLanguageTypeC);
dispatch_tsd_indexes_s.StartTagDeclarationDefinition();
dispatch_tsd_indexes_s.AddFieldToRecordType ("dti_version", uint16, lldb::eAccessPublic, 0);
dispatch_tsd_indexes_s.AddFieldToRecordType ("dti_queue_index", uint16, lldb::eAccessPublic, 0);
dispatch_tsd_indexes_s.AddFieldToRecordType ("dti_voucher_index", uint16, lldb::eAccessPublic, 0);
dispatch_tsd_indexes_s.AddFieldToRecordType ("dti_qos_class_index", uint16, lldb::eAccessPublic, 0);
dispatch_tsd_indexes_s.CompleteTagDeclarationDefinition();

ClangASTContext::StartTagDeclarationDefinition(dispatch_tsd_indexes_s);
ClangASTContext::AddFieldToRecordType (dispatch_tsd_indexes_s, "dti_version", uint16, lldb::eAccessPublic, 0);
ClangASTContext::AddFieldToRecordType (dispatch_tsd_indexes_s, "dti_queue_index", uint16, lldb::eAccessPublic, 0);
ClangASTContext::AddFieldToRecordType (dispatch_tsd_indexes_s, "dti_voucher_index", uint16, lldb::eAccessPublic, 0);
ClangASTContext::AddFieldToRecordType (dispatch_tsd_indexes_s, "dti_qos_class_index", uint16, lldb::eAccessPublic, 0);
ClangASTContext::CompleteTagDeclarationDefinition(dispatch_tsd_indexes_s);

ProcessStructReader struct_reader (m_process, m_dispatch_tsd_indexes_addr, dispatch_tsd_indexes_s);

Expand Down
1 change: 1 addition & 0 deletions lldb/source/Symbol/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ add_lldb_library(lldbSymbol
Symtab.cpp
Type.cpp
TypeList.cpp
TypeSystem.cpp
UnwindPlan.cpp
UnwindTable.cpp
Variable.cpp
Expand Down
6,837 changes: 6,709 additions & 128 deletions lldb/source/Symbol/ClangASTContext.cpp

Large diffs are not rendered by default.

6,549 changes: 330 additions & 6,219 deletions lldb/source/Symbol/ClangASTType.cpp

Large diffs are not rendered by default.

47 changes: 25 additions & 22 deletions lldb/source/Symbol/Type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ Type::GetDeclaration () const
bool
Type::ResolveClangType (ResolveState clang_type_resolve_state)
{
// TODO: This needs to consider the correct type system to use.
Type *encoding_type = nullptr;
if (!m_clang_type.IsValid())
{
Expand All @@ -511,20 +512,21 @@ Type::ResolveClangType (ResolveState clang_type_resolve_state)
break;

case eEncodingIsConstUID:
m_clang_type = encoding_type->GetClangForwardType().AddConstModifier();
m_clang_type = ClangASTContext::AddConstModifier(encoding_type->GetClangForwardType());
break;

case eEncodingIsRestrictUID:
m_clang_type = encoding_type->GetClangForwardType().AddRestrictModifier();
m_clang_type = ClangASTContext::AddRestrictModifier(encoding_type->GetClangForwardType());
break;

case eEncodingIsVolatileUID:
m_clang_type = encoding_type->GetClangForwardType().AddVolatileModifier();
m_clang_type = ClangASTContext::AddVolatileModifier(encoding_type->GetClangForwardType());
break;

case eEncodingIsTypedefUID:
m_clang_type = encoding_type->GetClangForwardType().CreateTypedefType (GetName().AsCString(),
GetSymbolFile()->GetClangDeclContextContainingTypeUID(GetID()));
m_clang_type = ClangASTContext::CreateTypedefType (encoding_type->GetClangForwardType(),
GetName().AsCString(),
GetSymbolFile()->GetClangDeclContextContainingTypeUID(GetID()));
m_name.Clear();
break;

Expand All @@ -533,11 +535,11 @@ Type::ResolveClangType (ResolveState clang_type_resolve_state)
break;

case eEncodingIsLValueReferenceUID:
m_clang_type = encoding_type->GetClangForwardType().GetLValueReferenceType();
m_clang_type = ClangASTContext::GetLValueReferenceType(encoding_type->GetClangForwardType());
break;

case eEncodingIsRValueReferenceUID:
m_clang_type = encoding_type->GetClangForwardType().GetRValueReferenceType();
m_clang_type = ClangASTContext::GetRValueReferenceType(encoding_type->GetClangForwardType());
break;

default:
Expand All @@ -556,32 +558,33 @@ Type::ResolveClangType (ResolveState clang_type_resolve_state)
break;

case eEncodingIsConstUID:
m_clang_type = void_clang_type.AddConstModifier ();
m_clang_type = ClangASTContext::AddConstModifier (void_clang_type);
break;

case eEncodingIsRestrictUID:
m_clang_type = void_clang_type.AddRestrictModifier ();
m_clang_type = ClangASTContext::AddRestrictModifier (void_clang_type);
break;

case eEncodingIsVolatileUID:
m_clang_type = void_clang_type.AddVolatileModifier ();
m_clang_type = ClangASTContext::AddVolatileModifier (void_clang_type);
break;

case eEncodingIsTypedefUID:
m_clang_type = void_clang_type.CreateTypedefType (GetName().AsCString(),
GetSymbolFile()->GetClangDeclContextContainingTypeUID(GetID()));
m_clang_type = ClangASTContext::CreateTypedefType (void_clang_type,
GetName().AsCString(),
GetSymbolFile()->GetClangDeclContextContainingTypeUID(GetID()));
break;

case eEncodingIsPointerUID:
m_clang_type = void_clang_type.GetPointerType ();
break;

case eEncodingIsLValueReferenceUID:
m_clang_type = void_clang_type.GetLValueReferenceType ();
m_clang_type = ClangASTContext::GetLValueReferenceType(void_clang_type);
break;

case eEncodingIsRValueReferenceUID:
m_clang_type = void_clang_type.GetRValueReferenceType ();
m_clang_type = ClangASTContext::GetRValueReferenceType(void_clang_type);
break;

default:
Expand Down Expand Up @@ -724,7 +727,7 @@ Type::IsRealObjCClass()
// those don't have any information. We could extend this to only return true for "full
// definitions" if we can figure that out.

if (m_clang_type.IsObjCObjectOrInterfaceType() && GetByteSize() != 0)
if (ClangASTContext::IsObjCObjectOrInterfaceType(m_clang_type) && GetByteSize() != 0)
return true;
else
return false;
Expand Down Expand Up @@ -1171,7 +1174,7 @@ TypeImpl::GetReferenceType () const
{
if (m_dynamic_type.IsValid())
{
return TypeImpl(m_static_type.GetReferenceType(), m_dynamic_type.GetLValueReferenceType());
return TypeImpl(m_static_type.GetReferenceType(), ClangASTContext::GetLValueReferenceType(m_dynamic_type));
}
return TypeImpl(m_static_type.GetReferenceType());
}
Expand Down Expand Up @@ -1254,18 +1257,18 @@ TypeImpl::GetClangASTType (bool prefer_dynamic)
return ClangASTType();
}

clang::ASTContext *
TypeImpl::GetClangASTContext (bool prefer_dynamic)
TypeSystem *
TypeImpl::GetTypeSystem (bool prefer_dynamic)
{
ModuleSP module_sp;
if (CheckModule (module_sp))
{
if (prefer_dynamic)
{
if (m_dynamic_type.IsValid())
return m_dynamic_type.GetASTContext();
return m_dynamic_type.GetTypeSystem();
}
return m_static_type.GetClangASTContext();
return m_static_type.GetClangASTType().GetTypeSystem();
}
return NULL;
}
Expand Down Expand Up @@ -1376,7 +1379,7 @@ TypeMemberFunctionImpl::GetReturnType () const
if (m_type)
return m_type.GetFunctionReturnType();
if (m_objc_method_decl)
return ClangASTType(&m_objc_method_decl->getASTContext(),m_objc_method_decl->getReturnType().getAsOpaquePtr());
return ClangASTType(&m_objc_method_decl->getASTContext(), m_objc_method_decl->getReturnType());
return ClangASTType();
}

Expand All @@ -1398,7 +1401,7 @@ TypeMemberFunctionImpl::GetArgumentAtIndex (size_t idx) const
if (m_objc_method_decl)
{
if (idx < m_objc_method_decl->param_size())
return ClangASTType(&m_objc_method_decl->getASTContext(), m_objc_method_decl->parameters()[idx]->getOriginalType().getAsOpaquePtr());
return ClangASTType(&m_objc_method_decl->getASTContext(), m_objc_method_decl->parameters()[idx]->getOriginalType());
}
return ClangASTType();
}
Expand Down
20 changes: 20 additions & 0 deletions lldb/source/Symbol/TypeSystem.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// TypeSystem.cpp
// lldb
//
// Created by Ryan Brown on 3/29/15.
//
//

#include "lldb/Symbol/TypeSystem.h"

using namespace lldb_private;

TypeSystem::TypeSystem()
{
}

TypeSystem::~TypeSystem()
{

}
8 changes: 4 additions & 4 deletions lldb/source/Symbol/Variable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,13 +555,13 @@ PrivateAutoCompleteMembers (StackFrame *frame,
{

// We are in a type parsing child members
const uint32_t num_bases = clang_type.GetNumDirectBaseClasses();
const uint32_t num_bases = ClangASTContext::GetNumDirectBaseClasses(clang_type);

if (num_bases > 0)
{
for (uint32_t i = 0; i < num_bases; ++i)
{
ClangASTType base_class_type (clang_type.GetDirectBaseClassAtIndex (i, nullptr));
ClangASTType base_class_type (ClangASTContext::GetDirectBaseClassAtIndex(clang_type, i, nullptr));

PrivateAutoCompleteMembers (frame,
partial_member_name,
Expand All @@ -573,13 +573,13 @@ PrivateAutoCompleteMembers (StackFrame *frame,
}
}

const uint32_t num_vbases = clang_type.GetNumVirtualBaseClasses();
const uint32_t num_vbases = ClangASTContext::GetNumVirtualBaseClasses(clang_type);

if (num_vbases > 0)
{
for (uint32_t i = 0; i < num_vbases; ++i)
{
ClangASTType vbase_class_type (clang_type.GetVirtualBaseClassAtIndex(i,nullptr));
ClangASTType vbase_class_type (ClangASTContext::GetVirtualBaseClassAtIndex(clang_type, i,nullptr));

PrivateAutoCompleteMembers (frame,
partial_member_name,
Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Target/ObjCLanguageRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ ObjCLanguageRuntime::LookupInCompleteClassCache (ConstString &name)
{
TypeSP type_sp (types.GetTypeAtIndex(i));

if (type_sp->GetClangForwardType().IsObjCObjectOrInterfaceType())
if (ClangASTContext::IsObjCObjectOrInterfaceType(type_sp->GetClangForwardType()))
{
if (type_sp->IsCompleteObjCClass())
{
Expand Down Expand Up @@ -648,7 +648,7 @@ bool
ObjCLanguageRuntime::GetTypeBitSize (const ClangASTType& clang_type,
uint64_t &size)
{
void *opaque_ptr = clang_type.GetQualType().getAsOpaquePtr();
void *opaque_ptr = clang_type.GetOpaqueQualType();
size = m_type_size_cache.Lookup(opaque_ptr);
// an ObjC object will at least have an ISA, so 0 is definitely not OK
if (size > 0)
Expand Down