Simplify array bound checks and clarify comments. One element array can have same nonzero number as lower bound as well as upper bound.
gitsvnid: https://llvm.org/svn/llvmproject/llvm/trunk@129170 911773080d340410b5e696231b3b80d8
Devang Patel
9 years ago
707  707 
composite type. The low value defines

708  708 
the lower bounds typically zero for C/C++. The high value is the upper

709  709 
bounds. Values are 64 bit. High  low + 1 is the size of the array. If low

710  
> high the array will be unbounded.⏎

 710 
> high the array bounds are not included in generated debugging information.⏎

 711 

711  712 

712  713 

713  714 

1241  1241 
int64_t L = SR.getLo();

1242  1242 
int64_t H = SR.getHi();

1243  1243 

1244  
// The L value defines the lower bounds typically zero for C/C++. The H

1245  
// value is the upper bounds. Values are 64 bit. H  L + 1 is the size

1246  
// of the array. If L > H the array will be unbounded. If the L is

1247  
// non zero and same is H then also the array will be unbounded. If L is

1248  
// zero and H is zero then the array has one element and in such case do

1249  
// not emit lower bound.

1250  

1251  
if (L > H  (L == H && L != 0)) {

1252  
// This is an unbounded subrange.⏎

 1244 
// The L value defines the lower bounds which is typically zero for C/C++. The⏎

 1245 
// H value is the upper bounds. Values are 64 bit. H  L + 1 is the size

 1246 
// of the array. If L > H then do not emit DW_AT_lower_bound and

 1247 
// DW_AT_upper_bound attributes. If L is zero and H is also zero then the

 1248 
// array has one element and in such case do not emit lower bound.

 1249 

 1250 
if (L > H) {

1253  1251 
Buffer.addChild(DW_Subrange);

1254  1252 
return;

1255  1253 
}

1256  

1257  1254 
if (L)

1258  1255 
addSInt(DW_Subrange, dwarf::DW_AT_lower_bound, 0, L);

1259  1256 
addSInt(DW_Subrange, dwarf::DW_AT_upper_bound, 0, H);
