forked from OSchip/llvm-project
Add SBType::GetArrayType() such that - given a type - one can make an array (of a given size) of that type
This is currently only implemented for the clang-based TypeSystem, but other languages are welcome to jump in! llvm-svn: 280151
This commit is contained in:
parent
b7df1e2148
commit
639392fe76
lldb
include/lldb
scripts/interface
source
|
@ -188,6 +188,9 @@ public:
|
|||
lldb::SBType
|
||||
GetArrayElementType ();
|
||||
|
||||
lldb::SBType
|
||||
GetArrayType (uint64_t size);
|
||||
|
||||
lldb::SBType
|
||||
GetVectorElementType ();
|
||||
|
||||
|
|
|
@ -789,6 +789,9 @@ public:
|
|||
CompilerType
|
||||
GetArrayElementType (lldb::opaque_compiler_type_t type, uint64_t *stride) override;
|
||||
|
||||
CompilerType
|
||||
GetArrayType (lldb::opaque_compiler_type_t type, uint64_t size) override;
|
||||
|
||||
CompilerType
|
||||
GetCanonicalType (lldb::opaque_compiler_type_t type) override;
|
||||
|
||||
|
|
|
@ -268,6 +268,9 @@ public:
|
|||
CompilerType
|
||||
GetArrayElementType(uint64_t *stride = nullptr) const;
|
||||
|
||||
CompilerType
|
||||
GetArrayType (uint64_t size) const;
|
||||
|
||||
CompilerType
|
||||
GetCanonicalType () const;
|
||||
|
||||
|
|
|
@ -273,6 +273,9 @@ public:
|
|||
virtual CompilerType
|
||||
GetArrayElementType (lldb::opaque_compiler_type_t type, uint64_t *stride) = 0;
|
||||
|
||||
virtual CompilerType
|
||||
GetArrayType (lldb::opaque_compiler_type_t type, uint64_t size);
|
||||
|
||||
virtual CompilerType
|
||||
GetCanonicalType (lldb::opaque_compiler_type_t type) = 0;
|
||||
|
||||
|
|
|
@ -247,6 +247,9 @@ public:
|
|||
|
||||
lldb::SBType
|
||||
GetArrayElementType ();
|
||||
|
||||
lldb::SBType
|
||||
GetArrayType (uint64_t size);
|
||||
|
||||
lldb::SBType
|
||||
GetVectorElementType ();
|
||||
|
|
|
@ -228,6 +228,14 @@ SBType::GetArrayElementType()
|
|||
return SBType(TypeImplSP(new TypeImpl(m_opaque_sp->GetCompilerType(true).GetArrayElementType())));
|
||||
}
|
||||
|
||||
SBType
|
||||
SBType::GetArrayType (uint64_t size)
|
||||
{
|
||||
if (!IsValid())
|
||||
return SBType();
|
||||
return SBType(TypeImplSP(new TypeImpl(m_opaque_sp->GetCompilerType(true).GetArrayType(size))));
|
||||
}
|
||||
|
||||
SBType
|
||||
SBType::GetVectorElementType ()
|
||||
{
|
||||
|
|
|
@ -4565,6 +4565,24 @@ ClangASTContext::GetArrayElementType (lldb::opaque_compiler_type_t type, uint64_
|
|||
return CompilerType();
|
||||
}
|
||||
|
||||
CompilerType
|
||||
ClangASTContext::GetArrayType (lldb::opaque_compiler_type_t type, uint64_t size)
|
||||
{
|
||||
if (type)
|
||||
{
|
||||
clang::QualType qual_type(GetCanonicalQualType(type));
|
||||
if (clang::ASTContext *ast_ctx = getASTContext())
|
||||
{
|
||||
if (size == 0)
|
||||
return CompilerType (ast_ctx, ast_ctx->getConstantArrayType(qual_type, llvm::APInt(64, size), clang::ArrayType::ArraySizeModifier::Normal, 0));
|
||||
else
|
||||
return CompilerType (ast_ctx, ast_ctx->getIncompleteArrayType(qual_type, clang::ArrayType::ArraySizeModifier::Normal, 0));
|
||||
}
|
||||
}
|
||||
|
||||
return CompilerType();
|
||||
}
|
||||
|
||||
CompilerType
|
||||
ClangASTContext::GetCanonicalType (lldb::opaque_compiler_type_t type)
|
||||
{
|
||||
|
|
|
@ -467,7 +467,16 @@ CompilerType::GetArrayElementType (uint64_t *stride) const
|
|||
if (IsValid())
|
||||
{
|
||||
return m_type_system->GetArrayElementType(m_type, stride);
|
||||
|
||||
}
|
||||
return CompilerType();
|
||||
}
|
||||
|
||||
CompilerType
|
||||
CompilerType::GetArrayType (uint64_t size) const
|
||||
{
|
||||
if (IsValid())
|
||||
{
|
||||
return m_type_system->GetArrayType(m_type, size);
|
||||
}
|
||||
return CompilerType();
|
||||
}
|
||||
|
|
|
@ -61,6 +61,12 @@ TypeSystem::IsAnonymousType (lldb::opaque_compiler_type_t type)
|
|||
return false;
|
||||
}
|
||||
|
||||
CompilerType
|
||||
TypeSystem::GetArrayType (lldb::opaque_compiler_type_t type, uint64_t size)
|
||||
{
|
||||
return CompilerType();
|
||||
}
|
||||
|
||||
CompilerType
|
||||
TypeSystem::GetLValueReferenceType (lldb::opaque_compiler_type_t type)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue