forked from OSchip/llvm-project
Introduce a TypeSystem interface to support adding non-clang languages.
Reviewers: clayborg Reviewed By: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D8712 Original Author: Ryan Brown <ribrdb@google.com> llvm-svn: 239360
This commit is contained in:
parent
e6eea5d055
commit
c33ae024a6
|
@ -30,12 +30,13 @@
|
|||
#include "lldb/Core/ClangForward.h"
|
||||
#include "lldb/Core/ConstString.h"
|
||||
#include "lldb/Symbol/ClangASTType.h"
|
||||
#include "lldb/Symbol/TypeSystem.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
class Declaration;
|
||||
|
||||
class ClangASTContext
|
||||
class ClangASTContext : public TypeSystem
|
||||
{
|
||||
public:
|
||||
typedef void (*CompleteTagDeclCallback)(void *baton, clang::TagDecl *);
|
||||
|
@ -53,7 +54,7 @@ public:
|
|||
|
||||
clang::ASTContext *
|
||||
getASTContext();
|
||||
|
||||
|
||||
clang::Builtin::Context *
|
||||
getBuiltinContext();
|
||||
|
||||
|
@ -180,6 +181,16 @@ public:
|
|||
return ClangASTContext::GetUnknownAnyType(getASTContext());
|
||||
}
|
||||
|
||||
|
||||
static clang::DeclContext *
|
||||
GetDeclContextForType (clang::QualType type);
|
||||
|
||||
static clang::DeclContext *
|
||||
GetDeclContextForType (const ClangASTType& type)
|
||||
{
|
||||
return GetDeclContextForType(GetQualType(type));
|
||||
}
|
||||
|
||||
uint32_t
|
||||
GetPointerByteSize ();
|
||||
|
||||
|
@ -268,11 +279,6 @@ public:
|
|||
GetNumBaseClasses (const clang::CXXRecordDecl *cxx_record_decl,
|
||||
bool omit_empty_base_classes);
|
||||
|
||||
static uint32_t
|
||||
GetIndexForRecordBase (const clang::RecordDecl *record_decl,
|
||||
const clang::CXXBaseSpecifier *base_spec,
|
||||
bool omit_empty_base_classes);
|
||||
|
||||
ClangASTType
|
||||
CreateRecordType (clang::DeclContext *decl_ctx,
|
||||
lldb::AccessType access_type,
|
||||
|
@ -361,6 +367,17 @@ public:
|
|||
bool isForwardDecl,
|
||||
bool isInternal,
|
||||
ClangASTMetadata *metadata = NULL);
|
||||
|
||||
bool
|
||||
SetTagTypeKind (clang::QualType type, int kind) const;
|
||||
|
||||
bool
|
||||
SetDefaultAccessForRecordFields (clang::RecordDecl* record_decl,
|
||||
int default_accessibility,
|
||||
int *assigned_accessibilities,
|
||||
size_t num_assigned_accessibilities);
|
||||
|
||||
|
||||
|
||||
// Returns a mask containing bits from the ClangASTContext::eTypeXXX enumerations
|
||||
|
||||
|
@ -471,7 +488,538 @@ public:
|
|||
static ClangASTType
|
||||
GetFloatTypeFromBitSize (clang::ASTContext *ast,
|
||||
size_t bit_size);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// TypeSystem methods
|
||||
//------------------------------------------------------------------
|
||||
|
||||
ClangASTContext*
|
||||
AsClangASTContext()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Tests
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
bool
|
||||
IsArrayType (void* type,
|
||||
ClangASTType *element_type,
|
||||
uint64_t *size,
|
||||
bool *is_incomplete);
|
||||
|
||||
bool
|
||||
IsVectorType (void* type,
|
||||
ClangASTType *element_type,
|
||||
uint64_t *size);
|
||||
|
||||
bool
|
||||
IsAggregateType (void* type);
|
||||
|
||||
bool
|
||||
IsBeingDefined (void* type);
|
||||
|
||||
bool
|
||||
IsCharType (void* type);
|
||||
|
||||
bool
|
||||
IsCompleteType (void* type);
|
||||
|
||||
bool
|
||||
IsConst(void* type);
|
||||
|
||||
bool
|
||||
IsCStringType (void* type, uint32_t &length);
|
||||
|
||||
static bool
|
||||
IsCXXClassType (const ClangASTType& type);
|
||||
|
||||
bool
|
||||
IsDefined(void* type);
|
||||
|
||||
bool
|
||||
IsFloatingPointType (void* type, uint32_t &count, bool &is_complex);
|
||||
|
||||
bool
|
||||
IsFunctionType (void* type, bool *is_variadic_ptr = NULL);
|
||||
|
||||
uint32_t
|
||||
IsHomogeneousAggregate (void* type, ClangASTType* base_type_ptr);
|
||||
|
||||
size_t
|
||||
GetNumberOfFunctionArguments (void* type);
|
||||
|
||||
ClangASTType
|
||||
GetFunctionArgumentAtIndex (void* type, const size_t index);
|
||||
|
||||
bool
|
||||
IsFunctionPointerType (void* type);
|
||||
|
||||
bool
|
||||
IsIntegerType (void* type, bool &is_signed);
|
||||
|
||||
static bool
|
||||
IsObjCClassType (const ClangASTType& type);
|
||||
|
||||
static bool
|
||||
IsObjCClassTypeAndHasIVars (const ClangASTType& type, bool check_superclass);
|
||||
|
||||
static bool
|
||||
IsObjCObjectOrInterfaceType (const ClangASTType& type);
|
||||
|
||||
static bool
|
||||
IsObjCObjectPointerType (const ClangASTType& type, ClangASTType *target_type = NULL);
|
||||
|
||||
bool
|
||||
IsPolymorphicClass (void* type);
|
||||
|
||||
bool
|
||||
IsPossibleDynamicType (void* type,
|
||||
ClangASTType *target_type, // Can pass NULL
|
||||
bool check_cplusplus,
|
||||
bool check_objc);
|
||||
|
||||
bool
|
||||
IsRuntimeGeneratedType (void* type);
|
||||
|
||||
bool
|
||||
IsPointerType (void* type, ClangASTType *pointee_type = NULL);
|
||||
|
||||
bool
|
||||
IsPointerOrReferenceType (void* type, ClangASTType *pointee_type = NULL);
|
||||
|
||||
bool
|
||||
IsReferenceType (void* type, ClangASTType *pointee_type = nullptr, bool* is_rvalue = nullptr);
|
||||
|
||||
bool
|
||||
IsScalarType (void* type);
|
||||
|
||||
bool
|
||||
IsTypedefType (void* type);
|
||||
|
||||
bool
|
||||
IsVoidType (void* type);
|
||||
|
||||
static bool
|
||||
GetCXXClassName (const ClangASTType& type, std::string &class_name);
|
||||
|
||||
static bool
|
||||
GetObjCClassName (const ClangASTType& type, std::string &class_name);
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Type Completion
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
bool
|
||||
GetCompleteType (void* type);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Accessors
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
ConstString
|
||||
GetTypeName (void* type);
|
||||
|
||||
uint32_t
|
||||
GetTypeInfo (void* type, ClangASTType *pointee_or_element_clang_type = NULL);
|
||||
|
||||
lldb::LanguageType
|
||||
GetMinimumLanguage (void* type);
|
||||
|
||||
lldb::TypeClass
|
||||
GetTypeClass (void* type);
|
||||
|
||||
unsigned
|
||||
GetTypeQualifiers(void* type);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Creating related types
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
static ClangASTType
|
||||
AddConstModifier (const ClangASTType& type);
|
||||
|
||||
static ClangASTType
|
||||
AddRestrictModifier (const ClangASTType& type);
|
||||
|
||||
static ClangASTType
|
||||
AddVolatileModifier (const ClangASTType& type);
|
||||
|
||||
// Using the current type, create a new typedef to that type using "typedef_name"
|
||||
// as the name and "decl_ctx" as the decl context.
|
||||
static ClangASTType
|
||||
CreateTypedefType (const ClangASTType& type,
|
||||
const char *typedef_name,
|
||||
clang::DeclContext *decl_ctx);
|
||||
|
||||
ClangASTType
|
||||
GetArrayElementType (void* type, uint64_t *stride = nullptr);
|
||||
|
||||
ClangASTType
|
||||
GetCanonicalType (void* type);
|
||||
|
||||
ClangASTType
|
||||
GetFullyUnqualifiedType (void* type);
|
||||
|
||||
// Returns -1 if this isn't a function of if the function doesn't have a prototype
|
||||
// Returns a value >= 0 if there is a prototype.
|
||||
int
|
||||
GetFunctionArgumentCount (void* type);
|
||||
|
||||
ClangASTType
|
||||
GetFunctionArgumentTypeAtIndex (void* type, size_t idx);
|
||||
|
||||
ClangASTType
|
||||
GetFunctionReturnType (void* type);
|
||||
|
||||
size_t
|
||||
GetNumMemberFunctions (void* type);
|
||||
|
||||
TypeMemberFunctionImpl
|
||||
GetMemberFunctionAtIndex (void* type, size_t idx);
|
||||
|
||||
static ClangASTType
|
||||
GetLValueReferenceType (const ClangASTType& type);
|
||||
|
||||
ClangASTType
|
||||
GetNonReferenceType (void* type);
|
||||
|
||||
ClangASTType
|
||||
GetPointeeType (void* type);
|
||||
|
||||
ClangASTType
|
||||
GetPointerType (void* type);
|
||||
|
||||
static ClangASTType
|
||||
GetRValueReferenceType (const ClangASTType& type);
|
||||
|
||||
// If the current object represents a typedef type, get the underlying type
|
||||
ClangASTType
|
||||
GetTypedefedType (void* type);
|
||||
|
||||
static ClangASTType
|
||||
RemoveFastQualifiers (const ClangASTType& type);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Create related types using the current type's AST
|
||||
//----------------------------------------------------------------------
|
||||
ClangASTType
|
||||
GetBasicTypeFromAST (void* type, lldb::BasicType basic_type);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Exploring the type
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
uint64_t
|
||||
GetByteSize (void *type, ExecutionContextScope *exe_scope)
|
||||
{
|
||||
return (GetBitSize (type, exe_scope) + 7) / 8;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
GetBitSize (void* type, ExecutionContextScope *exe_scope);
|
||||
|
||||
lldb::Encoding
|
||||
GetEncoding (void* type, uint64_t &count);
|
||||
|
||||
lldb::Format
|
||||
GetFormat (void* type);
|
||||
|
||||
size_t
|
||||
GetTypeBitAlign (void* type);
|
||||
|
||||
uint32_t
|
||||
GetNumChildren (void* type, bool omit_empty_base_classes);
|
||||
|
||||
lldb::BasicType
|
||||
GetBasicTypeEnumeration (void* type);
|
||||
|
||||
static lldb::BasicType
|
||||
GetBasicTypeEnumeration (void* type, const ConstString &name);
|
||||
|
||||
static uint32_t
|
||||
GetNumDirectBaseClasses (const ClangASTType& type);
|
||||
|
||||
static uint32_t
|
||||
GetNumVirtualBaseClasses (const ClangASTType& type);
|
||||
|
||||
uint32_t
|
||||
GetNumFields (void* type);
|
||||
|
||||
static ClangASTType
|
||||
GetDirectBaseClassAtIndex (const ClangASTType& type,
|
||||
size_t idx,
|
||||
uint32_t *bit_offset_ptr);
|
||||
|
||||
static ClangASTType
|
||||
GetVirtualBaseClassAtIndex (const ClangASTType& type,
|
||||
size_t idx,
|
||||
uint32_t *bit_offset_ptr);
|
||||
|
||||
ClangASTType
|
||||
GetFieldAtIndex (void* type,
|
||||
size_t idx,
|
||||
std::string& name,
|
||||
uint64_t *bit_offset_ptr,
|
||||
uint32_t *bitfield_bit_size_ptr,
|
||||
bool *is_bitfield_ptr);
|
||||
|
||||
static uint32_t
|
||||
GetNumPointeeChildren (clang::QualType type);
|
||||
|
||||
ClangASTType
|
||||
GetChildClangTypeAtIndex (void* type,
|
||||
ExecutionContext *exe_ctx,
|
||||
size_t idx,
|
||||
bool transparent_pointers,
|
||||
bool omit_empty_base_classes,
|
||||
bool ignore_array_bounds,
|
||||
std::string& child_name,
|
||||
uint32_t &child_byte_size,
|
||||
int32_t &child_byte_offset,
|
||||
uint32_t &child_bitfield_bit_size,
|
||||
uint32_t &child_bitfield_bit_offset,
|
||||
bool &child_is_base_class,
|
||||
bool &child_is_deref_of_parent,
|
||||
ValueObject *valobj);
|
||||
|
||||
// Lookup a child given a name. This function will match base class names
|
||||
// and member member names in "clang_type" only, not descendants.
|
||||
uint32_t
|
||||
GetIndexOfChildWithName (void* type,
|
||||
const char *name,
|
||||
bool omit_empty_base_classes);
|
||||
|
||||
// Lookup a child member given a name. This function will match member names
|
||||
// only and will descend into "clang_type" children in search for the first
|
||||
// member in this class, or any base class that matches "name".
|
||||
// TODO: Return all matches for a given name by returning a vector<vector<uint32_t>>
|
||||
// so we catch all names that match a given child name, not just the first.
|
||||
size_t
|
||||
GetIndexOfChildMemberWithName (void* type,
|
||||
const char *name,
|
||||
bool omit_empty_base_classes,
|
||||
std::vector<uint32_t>& child_indexes);
|
||||
|
||||
static size_t
|
||||
GetNumTemplateArguments (const ClangASTType& type);
|
||||
|
||||
static ClangASTType
|
||||
GetTemplateArgument (const ClangASTType& type,
|
||||
size_t idx,
|
||||
lldb::TemplateArgumentKind &kind);
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Modifying RecordType
|
||||
//----------------------------------------------------------------------
|
||||
static clang::FieldDecl *
|
||||
AddFieldToRecordType (const ClangASTType& type,
|
||||
const char *name,
|
||||
const ClangASTType &field_type,
|
||||
lldb::AccessType access,
|
||||
uint32_t bitfield_bit_size);
|
||||
|
||||
static void
|
||||
BuildIndirectFields (const ClangASTType& type);
|
||||
|
||||
static void
|
||||
SetIsPacked (const ClangASTType& type);
|
||||
|
||||
static clang::VarDecl *
|
||||
AddVariableToRecordType (const ClangASTType& type,
|
||||
const char *name,
|
||||
const ClangASTType &var_type,
|
||||
lldb::AccessType access);
|
||||
|
||||
clang::CXXMethodDecl *
|
||||
AddMethodToCXXRecordType (void* type,
|
||||
const char *name,
|
||||
const ClangASTType &method_type,
|
||||
lldb::AccessType access,
|
||||
bool is_virtual,
|
||||
bool is_static,
|
||||
bool is_inline,
|
||||
bool is_explicit,
|
||||
bool is_attr_used,
|
||||
bool is_artificial);
|
||||
|
||||
// C++ Base Classes
|
||||
clang::CXXBaseSpecifier *
|
||||
CreateBaseClassSpecifier (void* type,
|
||||
lldb::AccessType access,
|
||||
bool is_virtual,
|
||||
bool base_of_class);
|
||||
|
||||
static void
|
||||
DeleteBaseClassSpecifiers (clang::CXXBaseSpecifier **base_classes,
|
||||
unsigned num_base_classes);
|
||||
|
||||
bool
|
||||
SetBaseClassesForClassType (void* type,
|
||||
clang::CXXBaseSpecifier const * const *base_classes,
|
||||
unsigned num_base_classes);
|
||||
|
||||
|
||||
static bool
|
||||
SetObjCSuperClass (const ClangASTType& type,
|
||||
const ClangASTType &superclass_clang_type);
|
||||
|
||||
static bool
|
||||
AddObjCClassProperty (const ClangASTType& type,
|
||||
const char *property_name,
|
||||
const ClangASTType &property_clang_type,
|
||||
clang::ObjCIvarDecl *ivar_decl,
|
||||
const char *property_setter_name,
|
||||
const char *property_getter_name,
|
||||
uint32_t property_attributes,
|
||||
ClangASTMetadata *metadata);
|
||||
|
||||
static clang::ObjCMethodDecl *
|
||||
AddMethodToObjCObjectType (const ClangASTType& type,
|
||||
const char *name, // the full symbol name as seen in the symbol table (void* type, "-[NString stringWithCString:]")
|
||||
const ClangASTType &method_clang_type,
|
||||
lldb::AccessType access,
|
||||
bool is_artificial);
|
||||
|
||||
bool
|
||||
SetHasExternalStorage (void* type, bool has_extern);
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Tag Declarations
|
||||
//------------------------------------------------------------------
|
||||
static bool
|
||||
StartTagDeclarationDefinition (const ClangASTType &type);
|
||||
|
||||
static bool
|
||||
CompleteTagDeclarationDefinition (const ClangASTType &type);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Modifying Enumeration types
|
||||
//----------------------------------------------------------------------
|
||||
bool
|
||||
AddEnumerationValueToEnumerationType (void* type,
|
||||
const ClangASTType &enumerator_qual_type,
|
||||
const Declaration &decl,
|
||||
const char *name,
|
||||
int64_t enum_value,
|
||||
uint32_t enum_value_bit_size);
|
||||
|
||||
|
||||
|
||||
ClangASTType
|
||||
GetEnumerationIntegerType (void* type);
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Pointers & References
|
||||
//------------------------------------------------------------------
|
||||
|
||||
// Call this function using the class type when you want to make a
|
||||
// member pointer type to pointee_type.
|
||||
static ClangASTType
|
||||
CreateMemberPointerType (const ClangASTType& type, const ClangASTType &pointee_type);
|
||||
|
||||
|
||||
// Converts "s" to a floating point value and place resulting floating
|
||||
// point bytes in the "dst" buffer.
|
||||
size_t
|
||||
ConvertStringToFloatValue (void* type,
|
||||
const char *s,
|
||||
uint8_t *dst,
|
||||
size_t dst_size);
|
||||
//----------------------------------------------------------------------
|
||||
// Dumping types
|
||||
//----------------------------------------------------------------------
|
||||
void
|
||||
DumpValue (void* type,
|
||||
ExecutionContext *exe_ctx,
|
||||
Stream *s,
|
||||
lldb::Format format,
|
||||
const DataExtractor &data,
|
||||
lldb::offset_t data_offset,
|
||||
size_t data_byte_size,
|
||||
uint32_t bitfield_bit_size,
|
||||
uint32_t bitfield_bit_offset,
|
||||
bool show_types,
|
||||
bool show_summary,
|
||||
bool verbose,
|
||||
uint32_t depth);
|
||||
|
||||
bool
|
||||
DumpTypeValue (void* type,
|
||||
Stream *s,
|
||||
lldb::Format format,
|
||||
const DataExtractor &data,
|
||||
lldb::offset_t data_offset,
|
||||
size_t data_byte_size,
|
||||
uint32_t bitfield_bit_size,
|
||||
uint32_t bitfield_bit_offset,
|
||||
ExecutionContextScope *exe_scope);
|
||||
|
||||
void
|
||||
DumpSummary (void* type,
|
||||
ExecutionContext *exe_ctx,
|
||||
Stream *s,
|
||||
const DataExtractor &data,
|
||||
lldb::offset_t data_offset,
|
||||
size_t data_byte_size);
|
||||
|
||||
virtual void
|
||||
DumpTypeDescription (void* type); // Dump to stdout
|
||||
|
||||
void
|
||||
DumpTypeDescription (void* type, Stream *s);
|
||||
|
||||
static clang::EnumDecl *
|
||||
GetAsEnumDecl (const ClangASTType& type);
|
||||
|
||||
|
||||
static clang::RecordDecl *
|
||||
GetAsRecordDecl (const ClangASTType& type);
|
||||
|
||||
clang::CXXRecordDecl *
|
||||
GetAsCXXRecordDecl (void* type);
|
||||
|
||||
static clang::ObjCInterfaceDecl *
|
||||
GetAsObjCInterfaceDecl (const ClangASTType& type);
|
||||
|
||||
static clang::QualType
|
||||
GetQualType (const ClangASTType& type)
|
||||
{
|
||||
if (type && type.GetTypeSystem()->AsClangASTContext())
|
||||
return clang::QualType::getFromOpaquePtr(type.GetOpaqueQualType());
|
||||
return clang::QualType();
|
||||
}
|
||||
static clang::QualType
|
||||
GetCanonicalQualType (const ClangASTType& type)
|
||||
{
|
||||
if (type && type.GetTypeSystem()->AsClangASTContext())
|
||||
return clang::QualType::getFromOpaquePtr(type.GetOpaqueQualType()).getCanonicalType();
|
||||
return clang::QualType();
|
||||
}
|
||||
|
||||
protected:
|
||||
static clang::QualType
|
||||
GetQualType (void *type)
|
||||
{
|
||||
if (type)
|
||||
return clang::QualType::getFromOpaquePtr(type);
|
||||
return clang::QualType();
|
||||
}
|
||||
|
||||
static clang::QualType
|
||||
GetCanonicalQualType (void *type)
|
||||
{
|
||||
if (type)
|
||||
return clang::QualType::getFromOpaquePtr(type).getCanonicalType();
|
||||
return clang::QualType();
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Classes that inherit from ClangASTContext can see and modify these
|
||||
//------------------------------------------------------------------
|
||||
|
|
|
@ -33,23 +33,18 @@ public:
|
|||
//----------------------------------------------------------------------
|
||||
// Constructors and Destructors
|
||||
//----------------------------------------------------------------------
|
||||
ClangASTType (clang::ASTContext *ast_context, lldb::clang_type_t type) :
|
||||
m_type (type),
|
||||
m_ast (ast_context)
|
||||
{
|
||||
}
|
||||
|
||||
ClangASTType (TypeSystem *type_system, void *type);
|
||||
ClangASTType (clang::ASTContext *ast_context, clang::QualType qual_type);
|
||||
|
||||
ClangASTType (const ClangASTType &rhs) :
|
||||
m_type (rhs.m_type),
|
||||
m_ast (rhs.m_ast)
|
||||
m_type_system (rhs.m_type_system)
|
||||
{
|
||||
}
|
||||
|
||||
ClangASTType () :
|
||||
m_type (0),
|
||||
m_ast (0)
|
||||
m_type_system (0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -63,7 +58,7 @@ public:
|
|||
operator= (const ClangASTType &rhs)
|
||||
{
|
||||
m_type = rhs.m_type;
|
||||
m_ast = rhs.m_ast;
|
||||
m_type_system = rhs.m_type_system;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -74,21 +69,21 @@ public:
|
|||
|
||||
explicit operator bool () const
|
||||
{
|
||||
return m_type != NULL && m_ast != NULL;
|
||||
return m_type != NULL && m_type_system != NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
operator < (const ClangASTType &rhs) const
|
||||
{
|
||||
if (m_ast == rhs.m_ast)
|
||||
if (m_type_system == rhs.m_type_system)
|
||||
return m_type < rhs.m_type;
|
||||
return m_ast < rhs.m_ast;
|
||||
return m_type_system < rhs.m_type_system;
|
||||
}
|
||||
|
||||
bool
|
||||
IsValid () const
|
||||
{
|
||||
return m_type != NULL && m_ast != NULL;
|
||||
return m_type != NULL && m_type_system != NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -121,9 +116,6 @@ public:
|
|||
bool
|
||||
IsCStringType (uint32_t &length) const;
|
||||
|
||||
bool
|
||||
IsCXXClassType () const;
|
||||
|
||||
bool
|
||||
IsDefined() const;
|
||||
|
||||
|
@ -150,18 +142,6 @@ public:
|
|||
|
||||
bool
|
||||
IsIntegerType (bool &is_signed) const;
|
||||
|
||||
bool
|
||||
IsObjCClassType () const;
|
||||
|
||||
bool
|
||||
IsObjCClassTypeAndHasIVars (bool check_superclass) const;
|
||||
|
||||
bool
|
||||
IsObjCObjectOrInterfaceType () const;
|
||||
|
||||
bool
|
||||
IsObjCObjectPointerType (ClangASTType *target_type = NULL);
|
||||
|
||||
bool
|
||||
IsPolymorphicClass () const;
|
||||
|
@ -202,13 +182,6 @@ public:
|
|||
bool
|
||||
IsVoidType () const;
|
||||
|
||||
bool
|
||||
GetCXXClassName (std::string &class_name) const;
|
||||
|
||||
bool
|
||||
GetObjCClassName (std::string &class_name);
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Type Completion
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -227,10 +200,10 @@ public:
|
|||
// Accessors
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
clang::ASTContext *
|
||||
GetASTContext() const
|
||||
TypeSystem *
|
||||
GetTypeSystem() const
|
||||
{
|
||||
return m_ast;
|
||||
return m_type_system;
|
||||
}
|
||||
|
||||
ConstString
|
||||
|
@ -251,7 +224,7 @@ public:
|
|||
lldb::LanguageType
|
||||
GetMinimumLanguage ();
|
||||
|
||||
lldb::clang_type_t
|
||||
void *
|
||||
GetOpaqueQualType() const
|
||||
{
|
||||
return m_type;
|
||||
|
@ -261,12 +234,7 @@ public:
|
|||
GetTypeClass () const;
|
||||
|
||||
void
|
||||
SetClangType (clang::ASTContext *ast, lldb::clang_type_t type)
|
||||
{
|
||||
m_ast = ast;
|
||||
m_type = type;
|
||||
}
|
||||
|
||||
SetClangType (TypeSystem* type_system, void* type);
|
||||
void
|
||||
SetClangType (clang::ASTContext *ast, clang::QualType qual_type);
|
||||
|
||||
|
@ -276,21 +244,6 @@ public:
|
|||
//----------------------------------------------------------------------
|
||||
// Creating related types
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
ClangASTType
|
||||
AddConstModifier () const;
|
||||
|
||||
ClangASTType
|
||||
AddRestrictModifier () const;
|
||||
|
||||
ClangASTType
|
||||
AddVolatileModifier () const;
|
||||
|
||||
// Using the current type, create a new typedef to that type using "typedef_name"
|
||||
// as the name and "decl_ctx" as the decl context.
|
||||
ClangASTType
|
||||
CreateTypedefType (const char *typedef_name,
|
||||
clang::DeclContext *decl_ctx) const;
|
||||
|
||||
ClangASTType
|
||||
GetArrayElementType (uint64_t *stride = nullptr) const;
|
||||
|
@ -318,9 +271,6 @@ public:
|
|||
TypeMemberFunctionImpl
|
||||
GetMemberFunctionAtIndex (size_t idx);
|
||||
|
||||
ClangASTType
|
||||
GetLValueReferenceType () const;
|
||||
|
||||
ClangASTType
|
||||
GetNonReferenceType () const;
|
||||
|
||||
|
@ -329,16 +279,10 @@ public:
|
|||
|
||||
ClangASTType
|
||||
GetPointerType () const;
|
||||
|
||||
ClangASTType
|
||||
GetRValueReferenceType () const;
|
||||
|
||||
// If the current object represents a typedef type, get the underlying type
|
||||
ClangASTType
|
||||
GetTypedefedType () const;
|
||||
|
||||
ClangASTType
|
||||
RemoveFastQualifiers () const;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Create related types using the current type's AST
|
||||
|
@ -373,24 +317,10 @@ public:
|
|||
|
||||
static lldb::BasicType
|
||||
GetBasicTypeEnumeration (const ConstString &name);
|
||||
|
||||
uint32_t
|
||||
GetNumDirectBaseClasses () const;
|
||||
|
||||
uint32_t
|
||||
GetNumVirtualBaseClasses () const;
|
||||
|
||||
uint32_t
|
||||
GetNumFields () const;
|
||||
|
||||
ClangASTType
|
||||
GetDirectBaseClassAtIndex (size_t idx,
|
||||
uint32_t *bit_offset_ptr) const;
|
||||
|
||||
ClangASTType
|
||||
GetVirtualBaseClassAtIndex (size_t idx,
|
||||
uint32_t *bit_offset_ptr) const;
|
||||
|
||||
ClangASTType
|
||||
GetFieldAtIndex (size_t idx,
|
||||
std::string& name,
|
||||
|
@ -405,9 +335,6 @@ public:
|
|||
uint32_t *bitfield_bit_size_ptr = NULL,
|
||||
bool *is_bitfield_ptr = NULL) const;
|
||||
|
||||
uint32_t
|
||||
GetNumPointeeChildren () const;
|
||||
|
||||
ClangASTType
|
||||
GetChildClangTypeAtIndex (ExecutionContext *exe_ctx,
|
||||
size_t idx,
|
||||
|
@ -439,133 +366,10 @@ public:
|
|||
bool omit_empty_base_classes,
|
||||
std::vector<uint32_t>& child_indexes) const;
|
||||
|
||||
size_t
|
||||
GetNumTemplateArguments () const;
|
||||
|
||||
ClangASTType
|
||||
GetTemplateArgument (size_t idx,
|
||||
lldb::TemplateArgumentKind &kind) const;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Modifying RecordType
|
||||
//----------------------------------------------------------------------
|
||||
clang::FieldDecl *
|
||||
AddFieldToRecordType (const char *name,
|
||||
const ClangASTType &field_type,
|
||||
lldb::AccessType access,
|
||||
uint32_t bitfield_bit_size);
|
||||
|
||||
void
|
||||
BuildIndirectFields ();
|
||||
|
||||
void
|
||||
SetIsPacked ();
|
||||
|
||||
clang::VarDecl *
|
||||
AddVariableToRecordType (const char *name,
|
||||
const ClangASTType &var_type,
|
||||
lldb::AccessType access);
|
||||
|
||||
clang::CXXMethodDecl *
|
||||
AddMethodToCXXRecordType (const char *name,
|
||||
const ClangASTType &method_type,
|
||||
lldb::AccessType access,
|
||||
bool is_virtual,
|
||||
bool is_static,
|
||||
bool is_inline,
|
||||
bool is_explicit,
|
||||
bool is_attr_used,
|
||||
bool is_artificial);
|
||||
|
||||
// C++ Base Classes
|
||||
clang::CXXBaseSpecifier *
|
||||
CreateBaseClassSpecifier (lldb::AccessType access,
|
||||
bool is_virtual,
|
||||
bool base_of_class);
|
||||
|
||||
static void
|
||||
DeleteBaseClassSpecifiers (clang::CXXBaseSpecifier **base_classes,
|
||||
unsigned num_base_classes);
|
||||
|
||||
bool
|
||||
SetBaseClassesForClassType (clang::CXXBaseSpecifier const * const *base_classes,
|
||||
unsigned num_base_classes);
|
||||
|
||||
|
||||
bool
|
||||
SetObjCSuperClass (const ClangASTType &superclass_clang_type);
|
||||
|
||||
bool
|
||||
AddObjCClassProperty (const char *property_name,
|
||||
const ClangASTType &property_clang_type,
|
||||
clang::ObjCIvarDecl *ivar_decl,
|
||||
const char *property_setter_name,
|
||||
const char *property_getter_name,
|
||||
uint32_t property_attributes,
|
||||
ClangASTMetadata *metadata);
|
||||
|
||||
clang::ObjCMethodDecl *
|
||||
AddMethodToObjCObjectType (const char *name, // the full symbol name as seen in the symbol table ("-[NString stringWithCString:]")
|
||||
const ClangASTType &method_clang_type,
|
||||
lldb::AccessType access,
|
||||
bool is_artificial);
|
||||
|
||||
clang::DeclContext *
|
||||
GetDeclContextForType () const;
|
||||
|
||||
|
||||
bool
|
||||
SetDefaultAccessForRecordFields (int default_accessibility,
|
||||
int *assigned_accessibilities,
|
||||
size_t num_assigned_accessibilities);
|
||||
|
||||
bool
|
||||
SetHasExternalStorage (bool has_extern);
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// clang::TagType
|
||||
//------------------------------------------------------------------
|
||||
|
||||
bool
|
||||
SetTagTypeKind (int kind) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Tag Declarations
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
StartTagDeclarationDefinition ();
|
||||
|
||||
bool
|
||||
CompleteTagDeclarationDefinition ();
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Modifying Enumeration types
|
||||
//----------------------------------------------------------------------
|
||||
bool
|
||||
AddEnumerationValueToEnumerationType (const ClangASTType &enumerator_qual_type,
|
||||
const Declaration &decl,
|
||||
const char *name,
|
||||
int64_t enum_value,
|
||||
uint32_t enum_value_bit_size);
|
||||
|
||||
|
||||
|
||||
ClangASTType
|
||||
GetEnumerationIntegerType () const;
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Pointers & References
|
||||
//------------------------------------------------------------------
|
||||
|
||||
// Call this function using the class type when you want to make a
|
||||
// member pointer type to pointee_type.
|
||||
ClangASTType
|
||||
CreateMemberPointerType (const ClangASTType &pointee_type) const;
|
||||
|
||||
|
||||
// Converts "s" to a floating point value and place resulting floating
|
||||
// point bytes in the "dst" buffer.
|
||||
size_t
|
||||
|
@ -633,45 +437,16 @@ public:
|
|||
lldb::addr_t addr,
|
||||
AddressType address_type,
|
||||
StreamString &new_value);
|
||||
|
||||
clang::EnumDecl *
|
||||
GetAsEnumDecl () const;
|
||||
|
||||
|
||||
clang::RecordDecl *
|
||||
GetAsRecordDecl () const;
|
||||
|
||||
clang::CXXRecordDecl *
|
||||
GetAsCXXRecordDecl () const;
|
||||
|
||||
clang::ObjCInterfaceDecl *
|
||||
GetAsObjCInterfaceDecl () const;
|
||||
|
||||
void
|
||||
Clear()
|
||||
{
|
||||
m_type = NULL;
|
||||
m_ast = NULL;
|
||||
m_type_system = NULL;
|
||||
}
|
||||
|
||||
clang::QualType
|
||||
GetQualType () const
|
||||
{
|
||||
if (m_type)
|
||||
return clang::QualType::getFromOpaquePtr(m_type);
|
||||
return clang::QualType();
|
||||
}
|
||||
clang::QualType
|
||||
GetCanonicalQualType () const
|
||||
{
|
||||
if (m_type)
|
||||
return clang::QualType::getFromOpaquePtr(m_type).getCanonicalType();
|
||||
return clang::QualType();
|
||||
}
|
||||
|
||||
private:
|
||||
lldb::clang_type_t m_type;
|
||||
clang::ASTContext *m_ast;
|
||||
void* m_type;
|
||||
TypeSystem *m_type_system;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
TaggedASTType (lldb::clang_type_t type, clang::ASTContext *ast_context) :
|
||||
ClangASTType(ast_context, type)
|
||||
TaggedASTType (void *type, TypeSystem * type_system) :
|
||||
ClangASTType(type_system, type)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "lldb/Core/ClangForward.h"
|
||||
#include "lldb/Core/ConstString.h"
|
||||
#include "lldb/Core/UserID.h"
|
||||
#include "lldb/Symbol/ClangASTContext.h"
|
||||
#include "lldb/Symbol/ClangASTType.h"
|
||||
#include "lldb/Symbol/Declaration.h"
|
||||
|
||||
|
@ -443,8 +444,8 @@ public:
|
|||
GetReferenceType () const
|
||||
{
|
||||
if (type_sp)
|
||||
return type_sp->GetClangLayoutType().GetLValueReferenceType();
|
||||
return clang_type.GetLValueReferenceType();
|
||||
return ClangASTContext::GetLValueReferenceType(type_sp->GetClangLayoutType());
|
||||
return ClangASTContext::GetLValueReferenceType(clang_type);
|
||||
}
|
||||
|
||||
ClangASTType
|
||||
|
@ -479,10 +480,10 @@ public:
|
|||
return clang_type.GetCanonicalType();
|
||||
}
|
||||
|
||||
clang::ASTContext *
|
||||
GetClangASTContext () const
|
||||
TypeSystem *
|
||||
GetTypeSystem () const
|
||||
{
|
||||
return clang_type.GetASTContext();
|
||||
return clang_type.GetTypeSystem();
|
||||
}
|
||||
|
||||
lldb::ModuleSP
|
||||
|
@ -578,8 +579,8 @@ public:
|
|||
ClangASTType
|
||||
GetClangASTType (bool prefer_dynamic);
|
||||
|
||||
clang::ASTContext *
|
||||
GetClangASTContext (bool prefer_dynamic);
|
||||
TypeSystem *
|
||||
GetTypeSystem (bool prefer_dynamic);
|
||||
|
||||
bool
|
||||
GetDescription (lldb_private::Stream &strm,
|
||||
|
|
|
@ -0,0 +1,331 @@
|
|||
//===-- TypeSystem.h ------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_TypeSystem_h_
|
||||
#define liblldb_TypeSystem_h_
|
||||
|
||||
#include <string>
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Core/ClangForward.h"
|
||||
#include "clang/AST/Type.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface for representing the Type Systems in different languages.
|
||||
//----------------------------------------------------------------------
|
||||
class TypeSystem
|
||||
{
|
||||
public:
|
||||
//----------------------------------------------------------------------
|
||||
// Constructors and Destructors
|
||||
//----------------------------------------------------------------------
|
||||
TypeSystem ();
|
||||
|
||||
virtual ~TypeSystem ();
|
||||
|
||||
virtual ClangASTContext *
|
||||
AsClangASTContext() = 0;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Tests
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
virtual bool
|
||||
IsArrayType (void * type,
|
||||
ClangASTType *element_type,
|
||||
uint64_t *size,
|
||||
bool *is_incomplete) = 0;
|
||||
|
||||
virtual bool
|
||||
IsAggregateType (void * type) = 0;
|
||||
|
||||
virtual bool
|
||||
IsCharType (void * type) = 0;
|
||||
|
||||
virtual bool
|
||||
IsCompleteType (void * type) = 0;
|
||||
|
||||
virtual bool
|
||||
IsDefined(void * type) = 0;
|
||||
|
||||
virtual bool
|
||||
IsFloatingPointType (void * type, uint32_t &count, bool &is_complex) = 0;
|
||||
|
||||
virtual bool
|
||||
IsFunctionType (void * type, bool *is_variadic_ptr = NULL) = 0;
|
||||
|
||||
virtual size_t
|
||||
GetNumberOfFunctionArguments (void * type) = 0;
|
||||
|
||||
virtual ClangASTType
|
||||
GetFunctionArgumentAtIndex (void * type, const size_t index) = 0;
|
||||
|
||||
virtual bool
|
||||
IsFunctionPointerType (void * type) = 0;
|
||||
|
||||
virtual bool
|
||||
IsIntegerType (void * type, bool &is_signed) = 0;
|
||||
|
||||
virtual bool
|
||||
IsPossibleDynamicType (void * type,
|
||||
ClangASTType *target_type, // Can pass NULL
|
||||
bool check_cplusplus,
|
||||
bool check_objc) = 0;
|
||||
|
||||
virtual bool
|
||||
IsPointerType (void * type, ClangASTType *pointee_type = NULL) = 0;
|
||||
|
||||
virtual bool
|
||||
IsScalarType (void * type) = 0;
|
||||
|
||||
virtual bool
|
||||
IsVoidType (void * type) = 0;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Type Completion
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
virtual bool
|
||||
GetCompleteType (void * type) = 0;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// AST related queries
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
virtual uint32_t
|
||||
GetPointerByteSize () = 0;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Accessors
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
virtual ConstString
|
||||
GetTypeName (void * type) = 0;
|
||||
|
||||
virtual uint32_t
|
||||
GetTypeInfo (void * type, ClangASTType *pointee_or_element_clang_type = NULL) = 0;
|
||||
|
||||
virtual lldb::LanguageType
|
||||
GetMinimumLanguage (void * type) = 0;
|
||||
|
||||
virtual lldb::TypeClass
|
||||
GetTypeClass (void * type) = 0;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Creating related types
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
virtual ClangASTType
|
||||
GetArrayElementType (void * type, uint64_t *stride = nullptr) = 0;
|
||||
|
||||
virtual ClangASTType
|
||||
GetCanonicalType (void * type) = 0;
|
||||
|
||||
// Returns -1 if this isn't a function of if the function doesn't have a prototype
|
||||
// Returns a value >= 0 if there is a prototype.
|
||||
virtual int
|
||||
GetFunctionArgumentCount (void * type) = 0;
|
||||
|
||||
virtual ClangASTType
|
||||
GetFunctionArgumentTypeAtIndex (void * type, size_t idx) = 0;
|
||||
|
||||
virtual ClangASTType
|
||||
GetFunctionReturnType (void * type) = 0;
|
||||
|
||||
virtual size_t
|
||||
GetNumMemberFunctions (void * type) = 0;
|
||||
|
||||
virtual TypeMemberFunctionImpl
|
||||
GetMemberFunctionAtIndex (void * type, size_t idx) = 0;
|
||||
|
||||
virtual ClangASTType
|
||||
GetPointeeType (void * type) = 0;
|
||||
|
||||
virtual ClangASTType
|
||||
GetPointerType (void * type) = 0;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Exploring the type
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
virtual uint64_t
|
||||
GetBitSize (void * type, ExecutionContextScope *exe_scope) = 0;
|
||||
|
||||
virtual lldb::Encoding
|
||||
GetEncoding (void * type, uint64_t &count) = 0;
|
||||
|
||||
virtual lldb::Format
|
||||
GetFormat (void * type) = 0;
|
||||
|
||||
virtual uint32_t
|
||||
GetNumChildren (void * type, bool omit_empty_base_classes) = 0;
|
||||
|
||||
virtual lldb::BasicType
|
||||
GetBasicTypeEnumeration (void * type) = 0;
|
||||
|
||||
virtual uint32_t
|
||||
GetNumFields (void * type) = 0;
|
||||
|
||||
virtual ClangASTType
|
||||
GetFieldAtIndex (void * type,
|
||||
size_t idx,
|
||||
std::string& name,
|
||||
uint64_t *bit_offset_ptr,
|
||||
uint32_t *bitfield_bit_size_ptr,
|
||||
bool *is_bitfield_ptr) = 0;
|
||||
|
||||
virtual ClangASTType
|
||||
GetChildClangTypeAtIndex (void * type,
|
||||
ExecutionContext *exe_ctx,
|
||||
size_t idx,
|
||||
bool transparent_pointers,
|
||||
bool omit_empty_base_classes,
|
||||
bool ignore_array_bounds,
|
||||
std::string& child_name,
|
||||
uint32_t &child_byte_size,
|
||||
int32_t &child_byte_offset,
|
||||
uint32_t &child_bitfield_bit_size,
|
||||
uint32_t &child_bitfield_bit_offset,
|
||||
bool &child_is_base_class,
|
||||
bool &child_is_deref_of_parent,
|
||||
ValueObject *valobj) = 0;
|
||||
|
||||
// Lookup a child given a name. This function will match base class names
|
||||
// and member member names in "clang_type" only, not descendants.
|
||||
virtual uint32_t
|
||||
GetIndexOfChildWithName (void * type,
|
||||
const char *name,
|
||||
bool omit_empty_base_classes) = 0;
|
||||
|
||||
// Lookup a child member given a name. This function will match member names
|
||||
// only and will descend into "clang_type" children in search for the first
|
||||
// member in this class, or any base class that matches "name".
|
||||
// TODO: Return all matches for a given name by returning a vector<vector<uint32_t>>
|
||||
// so we catch all names that match a given child name, not just the first.
|
||||
virtual size_t
|
||||
GetIndexOfChildMemberWithName (void * type,
|
||||
const char *name,
|
||||
bool omit_empty_base_classes,
|
||||
std::vector<uint32_t>& child_indexes) = 0;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Dumping types
|
||||
//----------------------------------------------------------------------
|
||||
virtual void
|
||||
DumpValue (void * type,
|
||||
ExecutionContext *exe_ctx,
|
||||
Stream *s,
|
||||
lldb::Format format,
|
||||
const DataExtractor &data,
|
||||
lldb::offset_t data_offset,
|
||||
size_t data_byte_size,
|
||||
uint32_t bitfield_bit_size,
|
||||
uint32_t bitfield_bit_offset,
|
||||
bool show_types,
|
||||
bool show_summary,
|
||||
bool verbose,
|
||||
uint32_t depth) = 0;
|
||||
|
||||
virtual bool
|
||||
DumpTypeValue (void * type,
|
||||
Stream *s,
|
||||
lldb::Format format,
|
||||
const DataExtractor &data,
|
||||
lldb::offset_t data_offset,
|
||||
size_t data_byte_size,
|
||||
uint32_t bitfield_bit_size,
|
||||
uint32_t bitfield_bit_offset,
|
||||
ExecutionContextScope *exe_scope) = 0;
|
||||
|
||||
virtual void
|
||||
DumpTypeDescription (void * type) = 0; // Dump to stdout
|
||||
|
||||
virtual void
|
||||
DumpTypeDescription (void * type, Stream *s) = 0;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// TODO: These methods appear unused. Should they be removed?
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
virtual bool
|
||||
IsRuntimeGeneratedType (void * type) = 0;
|
||||
|
||||
virtual void
|
||||
DumpSummary (void * type,
|
||||
ExecutionContext *exe_ctx,
|
||||
Stream *s,
|
||||
const DataExtractor &data,
|
||||
lldb::offset_t data_offset,
|
||||
size_t data_byte_size) = 0;
|
||||
|
||||
// Converts "s" to a floating point value and place resulting floating
|
||||
// point bytes in the "dst" buffer.
|
||||
virtual size_t
|
||||
ConvertStringToFloatValue (void * type,
|
||||
const char *s,
|
||||
uint8_t *dst,
|
||||
size_t dst_size) = 0;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// TODO: Determine if these methods should move to ClangASTContext.
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
virtual bool
|
||||
IsPointerOrReferenceType (void * type, ClangASTType *pointee_type = NULL) = 0;
|
||||
|
||||
virtual unsigned
|
||||
GetTypeQualifiers(void * type) = 0;
|
||||
|
||||
virtual bool
|
||||
IsCStringType (void * type, uint32_t &length) = 0;
|
||||
|
||||
virtual size_t
|
||||
GetTypeBitAlign (void * type) = 0;
|
||||
|
||||
virtual ClangASTType
|
||||
GetBasicTypeFromAST (void * type, lldb::BasicType basic_type) = 0;
|
||||
|
||||
virtual bool
|
||||
IsBeingDefined (void * type) = 0;
|
||||
|
||||
virtual bool
|
||||
IsConst(void * type) = 0;
|
||||
|
||||
virtual uint32_t
|
||||
IsHomogeneousAggregate (void * type, ClangASTType* base_type_ptr) = 0;
|
||||
|
||||
virtual bool
|
||||
IsPolymorphicClass (void * type) = 0;
|
||||
|
||||
virtual bool
|
||||
IsTypedefType (void * type) = 0;
|
||||
|
||||
// If the current object represents a typedef type, get the underlying type
|
||||
virtual ClangASTType
|
||||
GetTypedefedType (void * type) = 0;
|
||||
|
||||
virtual bool
|
||||
IsVectorType (void * type,
|
||||
ClangASTType *element_type,
|
||||
uint64_t *size) = 0;
|
||||
|
||||
virtual ClangASTType
|
||||
GetFullyUnqualifiedType (void * type) = 0;
|
||||
|
||||
virtual ClangASTType
|
||||
GetNonReferenceType (void * type) = 0;
|
||||
|
||||
virtual bool
|
||||
IsReferenceType (void * type, ClangASTType *pointee_type = nullptr, bool* is_rvalue = nullptr) = 0;
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // #ifndef liblldb_TypeSystem_h_
|
|
@ -221,6 +221,7 @@ class Symtab;
|
|||
class SyntheticChildren;
|
||||
class SyntheticChildrenFrontEnd;
|
||||
class TypeFilterImpl;
|
||||
class TypeSystem;
|
||||
#ifndef LLDB_DISABLE_PYTHON
|
||||
class ScriptedSyntheticChildren;
|
||||
#endif
|
||||
|
|
|
@ -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 */; };
|
||||
|
@ -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>"; };
|
||||
|
@ -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 */,
|
||||
|
@ -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 */,
|
||||
|
|
|
@ -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())))
|
||||
{
|
||||
}
|
||||
|
@ -342,8 +342,13 @@ 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();
|
||||
}
|
||||
|
||||
|
@ -351,7 +356,7 @@ uint32_t
|
|||
SBType::GetNumberOfDirectBaseClasses ()
|
||||
{
|
||||
if (IsValid())
|
||||
return m_opaque_sp->GetClangASTType(true).GetNumDirectBaseClasses();
|
||||
return ClangASTContext::GetNumDirectBaseClasses(m_opaque_sp->GetClangASTType(true));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -359,7 +364,7 @@ uint32_t
|
|||
SBType::GetNumberOfVirtualBaseClasses ()
|
||||
{
|
||||
if (IsValid())
|
||||
return m_opaque_sp->GetClangASTType(true).GetNumVirtualBaseClasses();
|
||||
return ClangASTContext::GetNumVirtualBaseClasses(m_opaque_sp->GetClangASTType(true));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
@ -532,7 +533,7 @@ protected:
|
|||
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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
@ -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)
|
||||
|
|
|
@ -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())*/
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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::GetRValueReferenceType(deffed_referenced_type);
|
||||
GetPossibleMatches(valobj,
|
||||
deffed_referenced_type,
|
||||
reason | lldb_private::eFormatterChoiceCriterionNavigatedTypedefs,
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,10 @@ public:
|
|||
{
|
||||
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;
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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"
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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))
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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());
|
||||
|
@ -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());
|
||||
|
@ -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());
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
@ -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()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -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());
|
||||
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -363,7 +363,7 @@ public:
|
|||
|
||||
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;
|
||||
|
@ -390,7 +390,7 @@ public:
|
|||
++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!
|
||||
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -1591,11 +1591,11 @@ SymbolFileDWARF::ParseTemplateDIE (DWARFCompileUnit* dwarf_cu,
|
|||
llvm::APInt apint (lldb_type->GetByteSize() * 8, uval64, is_signed);
|
||||
template_param_infos.args.push_back (clang::TemplateArgument (*ast,
|
||||
llvm::APSInt(apint),
|
||||
clang_type.GetQualType()));
|
||||
ClangASTContext::GetQualType(clang_type)));
|
||||
}
|
||||
else
|
||||
{
|
||||
template_param_infos.args.push_back (clang::TemplateArgument (clang_type.GetQualType()));
|
||||
template_param_infos.args.push_back (clang::TemplateArgument (ClangASTContext::GetQualType(clang_type)));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1722,13 +1722,16 @@ public:
|
|||
bool
|
||||
Finalize()
|
||||
{
|
||||
return m_class_opaque_type.AddObjCClassProperty (m_property_name,
|
||||
m_property_opaque_type,
|
||||
m_ivar_decl,
|
||||
m_property_setter_name,
|
||||
m_property_getter_name,
|
||||
m_property_attributes,
|
||||
m_metadata_ap.get());
|
||||
ClangASTContext* ast = m_class_opaque_type.GetTypeSystem()->AsClangASTContext();
|
||||
assert(ast);
|
||||
return ast->AddObjCClassProperty (m_class_opaque_type,
|
||||
m_property_name,
|
||||
m_property_opaque_type,
|
||||
m_ivar_decl,
|
||||
m_property_setter_name,
|
||||
m_property_getter_name,
|
||||
m_property_attributes,
|
||||
m_metadata_ap.get());
|
||||
}
|
||||
private:
|
||||
ClangASTType m_class_opaque_type;
|
||||
|
@ -1822,6 +1825,9 @@ SymbolFileDWARF::ParseChildMembers
|
|||
uint32_t member_idx = 0;
|
||||
BitfieldInfo last_field_info;
|
||||
ModuleSP module = GetObjectFile()->GetModule();
|
||||
ClangASTContext* ast = class_clang_type.GetTypeSystem()->AsClangASTContext();
|
||||
if (ast == nullptr)
|
||||
return 0;
|
||||
|
||||
for (die = parent_die->GetFirstChild(); die != NULL; die = die->GetSibling())
|
||||
{
|
||||
|
@ -2010,7 +2016,8 @@ SymbolFileDWARF::ParseChildMembers
|
|||
{
|
||||
if (accessibility == eAccessNone)
|
||||
accessibility = eAccessPublic;
|
||||
class_clang_type.AddVariableToRecordType (name,
|
||||
ClangASTContext::AddVariableToRecordType (class_clang_type,
|
||||
name,
|
||||
var_type->GetClangLayoutType(),
|
||||
accessibility);
|
||||
}
|
||||
|
@ -2127,10 +2134,12 @@ SymbolFileDWARF::ParseChildMembers
|
|||
|
||||
if (anon_field_info.IsValid())
|
||||
{
|
||||
clang::FieldDecl *unnamed_bitfield_decl = class_clang_type.AddFieldToRecordType (NULL,
|
||||
GetClangASTContext().GetBuiltinTypeForEncodingAndBitSize(eEncodingSint, word_width),
|
||||
accessibility,
|
||||
anon_field_info.bit_size);
|
||||
clang::FieldDecl *unnamed_bitfield_decl =
|
||||
ClangASTContext::AddFieldToRecordType (class_clang_type,
|
||||
NULL,
|
||||
GetClangASTContext().GetBuiltinTypeForEncodingAndBitSize(eEncodingSint, word_width),
|
||||
accessibility,
|
||||
anon_field_info.bit_size);
|
||||
|
||||
layout_info.field_offsets.insert(
|
||||
std::make_pair(unnamed_bitfield_decl, anon_field_info.bit_offset));
|
||||
|
@ -2177,7 +2186,8 @@ SymbolFileDWARF::ParseChildMembers
|
|||
}
|
||||
}
|
||||
|
||||
field_decl = class_clang_type.AddFieldToRecordType (name,
|
||||
field_decl = ClangASTContext::AddFieldToRecordType (class_clang_type,
|
||||
name,
|
||||
member_clang_type,
|
||||
accessibility,
|
||||
bit_size);
|
||||
|
@ -2332,13 +2342,14 @@ SymbolFileDWARF::ParseChildMembers
|
|||
assert (base_class_clang_type);
|
||||
if (class_language == eLanguageTypeObjC)
|
||||
{
|
||||
class_clang_type.SetObjCSuperClass(base_class_clang_type);
|
||||
ast->SetObjCSuperClass(class_clang_type, base_class_clang_type);
|
||||
}
|
||||
else
|
||||
{
|
||||
base_classes.push_back (base_class_clang_type.CreateBaseClassSpecifier (accessibility,
|
||||
is_virtual,
|
||||
is_base_of_class));
|
||||
base_classes.push_back (ast->CreateBaseClassSpecifier (base_class_clang_type.GetOpaqueQualType(),
|
||||
accessibility,
|
||||
is_virtual,
|
||||
is_base_of_class));
|
||||
|
||||
if (is_virtual)
|
||||
{
|
||||
|
@ -2353,7 +2364,7 @@ SymbolFileDWARF::ParseChildMembers
|
|||
else
|
||||
{
|
||||
layout_info.base_offsets.insert(
|
||||
std::make_pair(base_class_clang_type.GetAsCXXRecordDecl(),
|
||||
std::make_pair(ast->GetAsCXXRecordDecl(base_class_clang_type.GetOpaqueQualType()),
|
||||
clang::CharUnits::fromQuantity(member_byte_offset)));
|
||||
}
|
||||
}
|
||||
|
@ -2474,7 +2485,7 @@ SymbolFileDWARF::ResolveTypeUID (DWARFCompileUnit* cu, const DWARFDebugInfoEntry
|
|||
bool
|
||||
SymbolFileDWARF::HasForwardDeclForClangType (const ClangASTType &clang_type)
|
||||
{
|
||||
ClangASTType clang_type_no_qualifiers = clang_type.RemoveFastQualifiers();
|
||||
ClangASTType clang_type_no_qualifiers = ClangASTContext::RemoveFastQualifiers(clang_type);
|
||||
const DWARFDebugInfoEntry* die = m_forward_decl_clang_type_to_die.lookup (clang_type_no_qualifiers.GetOpaqueQualType());
|
||||
return die != NULL;
|
||||
}
|
||||
|
@ -2484,7 +2495,7 @@ bool
|
|||
SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type)
|
||||
{
|
||||
// We have a struct/union/class/enum that needs to be fully resolved.
|
||||
ClangASTType clang_type_no_qualifiers = clang_type.RemoveFastQualifiers();
|
||||
ClangASTType clang_type_no_qualifiers = ClangASTContext::RemoveFastQualifiers(clang_type);
|
||||
const DWARFDebugInfoEntry* die = m_forward_decl_clang_type_to_die.lookup (clang_type_no_qualifiers.GetOpaqueQualType());
|
||||
if (die == NULL)
|
||||
{
|
||||
|
@ -2497,9 +2508,16 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type)
|
|||
// are done.
|
||||
m_forward_decl_clang_type_to_die.erase (clang_type_no_qualifiers.GetOpaqueQualType());
|
||||
|
||||
ClangASTContext* ast = clang_type.GetTypeSystem()->AsClangASTContext();
|
||||
if (ast == NULL)
|
||||
{
|
||||
// Not a clang type
|
||||
return true;
|
||||
}
|
||||
|
||||
// Disable external storage for this type so we don't get anymore
|
||||
// clang::ExternalASTSource queries for this type.
|
||||
clang_type.SetHasExternalStorage (false);
|
||||
ast->SetHasExternalStorage (clang_type.GetOpaqueQualType(), false);
|
||||
|
||||
DWARFDebugInfo* debug_info = DebugInfo();
|
||||
|
||||
|
@ -2530,12 +2548,12 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type)
|
|||
if (die->HasChildren())
|
||||
{
|
||||
LanguageType class_language = eLanguageTypeUnknown;
|
||||
if (clang_type.IsObjCObjectOrInterfaceType())
|
||||
if (ClangASTContext::IsObjCObjectOrInterfaceType(clang_type))
|
||||
{
|
||||
class_language = eLanguageTypeObjC;
|
||||
// For objective C we don't start the definition when
|
||||
// the class is created.
|
||||
clang_type.StartTagDeclarationDefinition ();
|
||||
ClangASTContext::StartTagDeclarationDefinition (clang_type);
|
||||
}
|
||||
|
||||
int tag_decl_kind = -1;
|
||||
|
@ -2642,7 +2660,7 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type)
|
|||
if (class_language != eLanguageTypeObjC)
|
||||
{
|
||||
if (is_a_class && tag_decl_kind != clang::TTK_Class)
|
||||
clang_type.SetTagTypeKind (clang::TTK_Class);
|
||||
GetClangASTContext().SetTagTypeKind (ClangASTContext::GetQualType(clang_type), clang::TTK_Class);
|
||||
}
|
||||
|
||||
// Since DW_TAG_structure_type gets used for both classes
|
||||
|
@ -2659,9 +2677,10 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type)
|
|||
{
|
||||
// This is a class and all members that didn't have
|
||||
// their access specified are private.
|
||||
clang_type.SetDefaultAccessForRecordFields (eAccessPrivate,
|
||||
&member_accessibilities.front(),
|
||||
member_accessibilities.size());
|
||||
GetClangASTContext().SetDefaultAccessForRecordFields (ast->GetAsRecordDecl(clang_type),
|
||||
eAccessPrivate,
|
||||
&member_accessibilities.front(),
|
||||
member_accessibilities.size());
|
||||
}
|
||||
|
||||
if (!base_classes.empty())
|
||||
|
@ -2692,24 +2711,26 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type)
|
|||
// below. Since we provide layout assistance, all ivars in this
|
||||
// class and other classes will be fine, this is the best we can do
|
||||
// short of crashing.
|
||||
base_class_type.StartTagDeclarationDefinition ();
|
||||
base_class_type.CompleteTagDeclarationDefinition ();
|
||||
|
||||
ClangASTContext::StartTagDeclarationDefinition (base_class_type);
|
||||
ClangASTContext::CompleteTagDeclarationDefinition (base_class_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
clang_type.SetBaseClassesForClassType (&base_classes.front(),
|
||||
base_classes.size());
|
||||
ast->SetBaseClassesForClassType (clang_type.GetOpaqueQualType(),
|
||||
&base_classes.front(),
|
||||
base_classes.size());
|
||||
|
||||
// Clang will copy each CXXBaseSpecifier in "base_classes"
|
||||
// so we have to free them all.
|
||||
ClangASTType::DeleteBaseClassSpecifiers (&base_classes.front(),
|
||||
base_classes.size());
|
||||
ClangASTContext::DeleteBaseClassSpecifiers (&base_classes.front(),
|
||||
base_classes.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clang_type.BuildIndirectFields ();
|
||||
clang_type.CompleteTagDeclarationDefinition ();
|
||||
ClangASTContext::BuildIndirectFields (clang_type);
|
||||
ClangASTContext::CompleteTagDeclarationDefinition (clang_type);
|
||||
|
||||
if (!layout_info.field_offsets.empty() ||
|
||||
!layout_info.base_offsets.empty() ||
|
||||
|
@ -2720,7 +2741,7 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type)
|
|||
if (layout_info.bit_size == 0)
|
||||
layout_info.bit_size = die->GetAttributeValueAsUnsigned(this, dwarf_cu, DW_AT_byte_size, 0) * 8;
|
||||
|
||||
clang::CXXRecordDecl *record_decl = clang_type.GetAsCXXRecordDecl();
|
||||
clang::CXXRecordDecl *record_decl = ast->GetAsCXXRecordDecl(clang_type.GetOpaqueQualType());
|
||||
if (record_decl)
|
||||
{
|
||||
if (log)
|
||||
|
@ -2785,7 +2806,7 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type)
|
|||
return (bool)clang_type;
|
||||
|
||||
case DW_TAG_enumeration_type:
|
||||
clang_type.StartTagDeclarationDefinition ();
|
||||
ClangASTContext::StartTagDeclarationDefinition (clang_type);
|
||||
if (die->HasChildren())
|
||||
{
|
||||
SymbolContext sc(GetCompUnitForDWARFCompUnit(dwarf_cu));
|
||||
|
@ -2793,7 +2814,7 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type)
|
|||
clang_type.IsIntegerType(is_signed);
|
||||
ParseChildEnumerators(sc, clang_type, is_signed, type->GetByteSize(), dwarf_cu, die);
|
||||
}
|
||||
clang_type.CompleteTagDeclarationDefinition ();
|
||||
ClangASTContext::CompleteTagDeclarationDefinition (clang_type);
|
||||
return (bool)clang_type;
|
||||
|
||||
default:
|
||||
|
@ -4664,12 +4685,17 @@ SymbolFileDWARF::ParseChildEnumerators
|
|||
|
||||
if (name && name[0] && got_value)
|
||||
{
|
||||
clang_type.AddEnumerationValueToEnumerationType (clang_type.GetEnumerationIntegerType(),
|
||||
decl,
|
||||
name,
|
||||
enum_value,
|
||||
enumerator_byte_size * 8);
|
||||
++enumerators_added;
|
||||
ClangASTContext* ast = clang_type.GetTypeSystem()->AsClangASTContext();
|
||||
if (ast)
|
||||
{
|
||||
ast->AddEnumerationValueToEnumerationType (clang_type.GetOpaqueQualType(),
|
||||
ast->GetEnumerationIntegerType(clang_type.GetOpaqueQualType()),
|
||||
decl,
|
||||
name,
|
||||
enum_value,
|
||||
enumerator_byte_size * 8);
|
||||
++enumerators_added;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4936,7 +4962,7 @@ SymbolFileDWARF::GetClangDeclContextContainingDIE (DWARFCompileUnit *cu, const D
|
|||
Type* type = ResolveType (cu, decl_ctx_die);
|
||||
if (type)
|
||||
{
|
||||
clang::DeclContext *decl_ctx = type->GetClangForwardType().GetDeclContextForType ();
|
||||
clang::DeclContext *decl_ctx = GetClangASTContext().GetDeclContextForType(type->GetClangForwardType());
|
||||
if (decl_ctx)
|
||||
{
|
||||
LinkDeclContextToDIE (decl_ctx, decl_ctx_die);
|
||||
|
@ -6238,7 +6264,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
}
|
||||
assert (tag_decl_kind != -1);
|
||||
bool clang_type_was_created = false;
|
||||
clang_type.SetClangType(ast.getASTContext(), m_forward_decl_die_to_clang_type.lookup (die));
|
||||
clang_type.SetClangType(&ast, m_forward_decl_die_to_clang_type.lookup (die));
|
||||
if (!clang_type)
|
||||
{
|
||||
const DWARFDebugInfoEntry *decl_ctx_die;
|
||||
|
@ -6295,7 +6321,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
// Store a forward declaration to this class type in case any
|
||||
// parameters in any class methods need it for the clang
|
||||
// types for function prototypes.
|
||||
LinkDeclContextToDIE(clang_type.GetDeclContextForType(), die);
|
||||
LinkDeclContextToDIE(ast.GetDeclContextForType(clang_type), die);
|
||||
type_sp.reset (new Type (MakeUserID(die->GetOffset()),
|
||||
this,
|
||||
type_name_const_str,
|
||||
|
@ -6360,12 +6386,12 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
if (die->HasChildren() == false)
|
||||
{
|
||||
// No children for this struct/union/class, lets finish it
|
||||
clang_type.StartTagDeclarationDefinition ();
|
||||
clang_type.CompleteTagDeclarationDefinition ();
|
||||
ClangASTContext::StartTagDeclarationDefinition (clang_type);
|
||||
ClangASTContext::CompleteTagDeclarationDefinition (clang_type);
|
||||
|
||||
if (tag == DW_TAG_structure_type) // this only applies in C
|
||||
{
|
||||
clang::RecordDecl *record_decl = clang_type.GetAsRecordDecl();
|
||||
clang::RecordDecl *record_decl = ClangASTContext::GetAsRecordDecl(clang_type);
|
||||
|
||||
if (record_decl)
|
||||
m_record_decl_to_layout_map.insert(std::make_pair(record_decl, LayoutInfo()));
|
||||
|
@ -6383,7 +6409,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
|
||||
if (class_language != eLanguageTypeObjC &&
|
||||
class_language != eLanguageTypeObjC_plus_plus)
|
||||
clang_type.StartTagDeclarationDefinition ();
|
||||
ClangASTContext::StartTagDeclarationDefinition (clang_type);
|
||||
|
||||
// Leave this as a forward declaration until we need
|
||||
// to know the details of the type. lldb_private::Type
|
||||
|
@ -6391,8 +6417,8 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
// "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition(Type *)"
|
||||
// When the definition needs to be defined.
|
||||
m_forward_decl_die_to_clang_type[die] = clang_type.GetOpaqueQualType();
|
||||
m_forward_decl_clang_type_to_die[clang_type.RemoveFastQualifiers().GetOpaqueQualType()] = die;
|
||||
clang_type.SetHasExternalStorage (true);
|
||||
m_forward_decl_clang_type_to_die[ClangASTContext::RemoveFastQualifiers(clang_type).GetOpaqueQualType()] = die;
|
||||
ast.SetHasExternalStorage (clang_type.GetOpaqueQualType(), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6448,7 +6474,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
DEBUG_PRINTF ("0x%8.8" PRIx64 ": %s (\"%s\")\n", MakeUserID(die->GetOffset()), DW_TAG_value_to_name(tag), type_name_cstr);
|
||||
|
||||
ClangASTType enumerator_clang_type;
|
||||
clang_type.SetClangType (ast.getASTContext(), m_forward_decl_die_to_clang_type.lookup (die));
|
||||
clang_type.SetClangType (&ast, m_forward_decl_die_to_clang_type.lookup (die));
|
||||
if (!clang_type)
|
||||
{
|
||||
if (encoding_uid != DW_INVALID_OFFSET)
|
||||
|
@ -6470,10 +6496,10 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
}
|
||||
else
|
||||
{
|
||||
enumerator_clang_type = clang_type.GetEnumerationIntegerType ();
|
||||
enumerator_clang_type = ast.GetEnumerationIntegerType (clang_type.GetOpaqueQualType());
|
||||
}
|
||||
|
||||
LinkDeclContextToDIE(clang_type.GetDeclContextForType(), die);
|
||||
LinkDeclContextToDIE(ClangASTContext::GetDeclContextForType(clang_type), die);
|
||||
|
||||
type_sp.reset( new Type (MakeUserID(die->GetOffset()),
|
||||
this,
|
||||
|
@ -6486,7 +6512,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
clang_type,
|
||||
Type::eResolveStateForward));
|
||||
|
||||
clang_type.StartTagDeclarationDefinition ();
|
||||
ClangASTContext::StartTagDeclarationDefinition (clang_type);
|
||||
if (die->HasChildren())
|
||||
{
|
||||
SymbolContext cu_sc(GetCompUnitForDWARFCompUnit(dwarf_cu));
|
||||
|
@ -6494,7 +6520,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
enumerator_clang_type.IsIntegerType(is_signed);
|
||||
ParseChildEnumerators(cu_sc, clang_type, is_signed, type_sp->GetByteSize(), dwarf_cu, die);
|
||||
}
|
||||
clang_type.CompleteTagDeclarationDefinition ();
|
||||
ClangASTContext::CompleteTagDeclarationDefinition (clang_type);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -6684,7 +6710,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
if (complete_objc_class_type_sp)
|
||||
{
|
||||
ClangASTType type_clang_forward_type = complete_objc_class_type_sp->GetClangForwardType();
|
||||
if (type_clang_forward_type.IsObjCObjectOrInterfaceType ())
|
||||
if (ClangASTContext::IsObjCObjectOrInterfaceType(type_clang_forward_type))
|
||||
class_opaque_type = type_clang_forward_type;
|
||||
}
|
||||
}
|
||||
|
@ -6696,10 +6722,11 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
if (accessibility == eAccessNone)
|
||||
accessibility = eAccessPublic;
|
||||
|
||||
clang::ObjCMethodDecl *objc_method_decl = class_opaque_type.AddMethodToObjCObjectType (type_name_cstr,
|
||||
clang_type,
|
||||
accessibility,
|
||||
is_artificial);
|
||||
clang::ObjCMethodDecl *objc_method_decl = ast.AddMethodToObjCObjectType (class_opaque_type,
|
||||
type_name_cstr,
|
||||
clang_type,
|
||||
accessibility,
|
||||
is_artificial);
|
||||
type_handled = objc_method_decl != NULL;
|
||||
if (type_handled)
|
||||
{
|
||||
|
@ -6819,7 +6846,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
else
|
||||
{
|
||||
ClangASTType class_opaque_type = class_type->GetClangForwardType();
|
||||
if (class_opaque_type.IsCXXClassType ())
|
||||
if (ClangASTContext::IsCXXClassType(class_opaque_type))
|
||||
{
|
||||
if (class_opaque_type.IsBeingDefined ())
|
||||
{
|
||||
|
@ -6847,15 +6874,16 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
|
||||
const bool is_attr_used = false;
|
||||
|
||||
cxx_method_decl = class_opaque_type.AddMethodToCXXRecordType (type_name_cstr,
|
||||
clang_type,
|
||||
accessibility,
|
||||
is_virtual,
|
||||
is_static,
|
||||
is_inline,
|
||||
is_explicit,
|
||||
is_attr_used,
|
||||
is_artificial);
|
||||
cxx_method_decl = ast.AddMethodToCXXRecordType (class_opaque_type.GetOpaqueQualType(),
|
||||
type_name_cstr,
|
||||
clang_type,
|
||||
accessibility,
|
||||
is_virtual,
|
||||
is_static,
|
||||
is_inline,
|
||||
is_explicit,
|
||||
is_attr_used,
|
||||
is_artificial);
|
||||
|
||||
type_handled = cxx_method_decl != NULL;
|
||||
|
||||
|
@ -7108,7 +7136,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
ClangASTType pointee_clang_type = pointee_type->GetClangForwardType();
|
||||
ClangASTType class_clang_type = class_type->GetClangLayoutType();
|
||||
|
||||
clang_type = pointee_clang_type.CreateMemberPointerType(class_clang_type);
|
||||
clang_type = ClangASTContext::CreateMemberPointerType(pointee_clang_type, class_clang_type);
|
||||
|
||||
byte_size = clang_type.GetByteSize(nullptr);
|
||||
|
||||
|
@ -8025,7 +8053,7 @@ SymbolFileDWARF::SearchDeclContext (const clang::DeclContext *decl_context,
|
|||
|
||||
Type *matching_type = ResolveType (dwarf_cu, die);
|
||||
|
||||
clang::QualType qual_type = matching_type->GetClangForwardType().GetQualType();
|
||||
clang::QualType qual_type = ClangASTContext::GetQualType(matching_type->GetClangForwardType());
|
||||
|
||||
if (const clang::TagType *tag_type = llvm::dyn_cast<clang::TagType>(qual_type.getTypePtr()))
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ add_lldb_library(lldbSymbol
|
|||
Symtab.cpp
|
||||
Type.cpp
|
||||
TypeList.cpp
|
||||
TypeSystem.cpp
|
||||
UnwindPlan.cpp
|
||||
UnwindTable.cpp
|
||||
Variable.cpp
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -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())
|
||||
{
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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:
|
||||
|
@ -556,20 +558,21 @@ 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:
|
||||
|
@ -577,11 +580,11 @@ Type::ResolveClangType (ResolveState clang_type_resolve_state)
|
|||
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:
|
||||
|
@ -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;
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -1254,8 +1257,8 @@ 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))
|
||||
|
@ -1263,9 +1266,9 @@ TypeImpl::GetClangASTContext (bool prefer_dynamic)
|
|||
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;
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
||||
}
|
|
@ -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,
|
||||
|
@ -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,
|
||||
|
|
|
@ -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())
|
||||
{
|
||||
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue