mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-22 03:39:03 +00:00
Simplify array bound checks and clarify comments. One element array can have same non-zero number as lower bound as well as upper bound.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129170 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
918035f802
commit
3f932a74be
@ -708,7 +708,8 @@ DW_TAG_inheritance = 28
|
|||||||
<a href="#format_composite_type">composite type</a>. The low value defines
|
<a href="#format_composite_type">composite type</a>. The low value defines
|
||||||
the lower bounds typically zero for C/C++. The high value is the upper
|
the lower bounds typically zero for C/C++. The high value is the upper
|
||||||
bounds. Values are 64 bit. High - low + 1 is the size of the array. If low
|
bounds. Values are 64 bit. High - low + 1 is the size of the array. If low
|
||||||
> high the array will be unbounded.</p>
|
> high the array bounds are not included in generated debugging information.
|
||||||
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1242,19 +1242,16 @@ void DwarfDebug::constructSubrangeDIE(DIE &Buffer, DISubrange SR, DIE *IndexTy){
|
|||||||
int64_t L = SR.getLo();
|
int64_t L = SR.getLo();
|
||||||
int64_t H = SR.getHi();
|
int64_t H = SR.getHi();
|
||||||
|
|
||||||
// The L value defines the lower bounds typically zero for C/C++. The H
|
// The L value defines the lower bounds which is typically zero for C/C++. The
|
||||||
// value is the upper bounds. Values are 64 bit. H - L + 1 is the size
|
// H value is the upper bounds. Values are 64 bit. H - L + 1 is the size
|
||||||
// of the array. If L > H the array will be unbounded. If the L is
|
// of the array. If L > H then do not emit DW_AT_lower_bound and
|
||||||
// non zero and same is H then also the array will be unbounded. If L is
|
// DW_AT_upper_bound attributes. If L is zero and H is also zero then the
|
||||||
// zero and H is zero then the array has one element and in such case do
|
// array has one element and in such case do not emit lower bound.
|
||||||
// not emit lower bound.
|
|
||||||
|
|
||||||
if (L > H || (L == H && L != 0)) {
|
if (L > H) {
|
||||||
// This is an unbounded subrange.
|
|
||||||
Buffer.addChild(DW_Subrange);
|
Buffer.addChild(DW_Subrange);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (L)
|
if (L)
|
||||||
addSInt(DW_Subrange, dwarf::DW_AT_lower_bound, 0, L);
|
addSInt(DW_Subrange, dwarf::DW_AT_lower_bound, 0, L);
|
||||||
addSInt(DW_Subrange, dwarf::DW_AT_upper_bound, 0, H);
|
addSInt(DW_Subrange, dwarf::DW_AT_upper_bound, 0, H);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user