Adjust CreateDerivedArrayType to also take the lower bound.
Since valid array bounds vary by language, this needs to be passed in by the source language creating the derived type. Adjust callers accordingly.
This commit is contained in:
@@ -253,8 +253,8 @@ DwarfType::CreateDerivedAddressType(address_type_kind addressType,
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
DwarfType::CreateDerivedArrayType(uint64 elementCount, bool extendExisting,
|
DwarfType::CreateDerivedArrayType(int64 lowerBound, int64 elementCount,
|
||||||
ArrayType*& _resultType)
|
bool extendExisting, ArrayType*& _resultType)
|
||||||
{
|
{
|
||||||
DwarfArrayType* resultType = NULL;
|
DwarfArrayType* resultType = NULL;
|
||||||
BReference<DwarfType> baseTypeReference;
|
BReference<DwarfType> baseTypeReference;
|
||||||
@@ -271,8 +271,8 @@ DwarfType::CreateDerivedArrayType(uint64 elementCount, bool extendExisting,
|
|||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
DwarfSubrangeType* subrangeType = new(std::nothrow) DwarfSubrangeType(
|
DwarfSubrangeType* subrangeType = new(std::nothrow) DwarfSubrangeType(
|
||||||
fTypeContext, fName, NULL, resultType, BVariant((uint64)0),
|
fTypeContext, fName, NULL, resultType, BVariant(lowerBound),
|
||||||
BVariant(elementCount - 1));
|
BVariant(lowerBound + elementCount - 1));
|
||||||
if (subrangeType == NULL)
|
if (subrangeType == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,8 @@ public:
|
|||||||
AddressType*& _resultType);
|
AddressType*& _resultType);
|
||||||
|
|
||||||
virtual status_t CreateDerivedArrayType(
|
virtual status_t CreateDerivedArrayType(
|
||||||
uint64 elementCount,
|
int64 lowerBound,
|
||||||
|
int64 elementCount,
|
||||||
bool extendExisting,
|
bool extendExisting,
|
||||||
ArrayType*& _resultType);
|
ArrayType*& _resultType);
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ Type::CreateDerivedAddressType(address_type_kind kind,
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
Type::CreateDerivedArrayType(uint64 elementCount,
|
Type::CreateDerivedArrayType(int64 lowerBound, int64 elementCount,
|
||||||
bool extendExisting, ArrayType*& _resultType)
|
bool extendExisting, ArrayType*& _resultType)
|
||||||
{
|
{
|
||||||
_resultType = NULL;
|
_resultType = NULL;
|
||||||
|
|||||||
@@ -141,7 +141,8 @@ public:
|
|||||||
AddressType*& _resultType);
|
AddressType*& _resultType);
|
||||||
|
|
||||||
virtual status_t CreateDerivedArrayType(
|
virtual status_t CreateDerivedArrayType(
|
||||||
uint64 elementCount,
|
int64 lowerBound,
|
||||||
|
int64 elementCount,
|
||||||
bool extendExisting,
|
bool extendExisting,
|
||||||
// if the current object is already
|
// if the current object is already
|
||||||
// an array type, attach an extra
|
// an array type, attach an extra
|
||||||
|
|||||||
@@ -123,10 +123,10 @@ CppLanguage::ParseTypeExpression(const BString &expression,
|
|||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
if (arrayType == NULL) {
|
if (arrayType == NULL) {
|
||||||
result = _resultType->CreateDerivedArrayType(size, true,
|
result = _resultType->CreateDerivedArrayType(0, size, true,
|
||||||
arrayType);
|
arrayType);
|
||||||
} else {
|
} else {
|
||||||
result = arrayType->CreateDerivedArrayType(size, true,
|
result = arrayType->CreateDerivedArrayType(0, size, true,
|
||||||
arrayType);
|
arrayType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user