[DebugInfo] Upgrade DISubrange to support Fortran dynamic arrays

This patch upgrades DISubrange to support fortran requirements.

Summary:
Below are the updates/addition of fields.
lowerBound - Now accepts signed integer or DIVariable or DIExpression,
earlier it accepted only signed integer.
upperBound - This field is now added and accepts signed interger or
DIVariable or DIExpression.
stride - This field is now added and accepts signed interger or
DIVariable or DIExpression.
This is required to describe bounds of array which are known at runtime.

Testing:
unit test cases added (hand-written)
check clang
check llvm
check debug-info

Reviewed By: aprantl

Differential Revision: https://reviews.llvm.org/D80197
This commit is contained in:
Alok Kumar Sharma
2020-05-28 13:31:22 +05:30
committed by Sourabh Singh Tomar
parent 213c6cdf2e
commit d20bf5a725
34 changed files with 813 additions and 84 deletions

View File

@@ -1258,14 +1258,24 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
// Operand 'count' is interpreted as:
// - Signed integer (version 0)
// - Metadata node (version 1)
// Operand 'lowerBound' is interpreted as:
// - Signed integer (version 0 and 1)
// - Metadata node (version 2)
// Operands 'upperBound' and 'stride' are interpreted as:
// - Metadata node (version 2)
switch (Record[0] >> 1) {
case 0:
Val = GET_OR_DISTINCT(DISubrange,
(Context, Record[1], unrotateSign(Record.back())));
(Context, Record[1], unrotateSign(Record[2])));
break;
case 1:
Val = GET_OR_DISTINCT(DISubrange, (Context, getMDOrNull(Record[1]),
unrotateSign(Record.back())));
unrotateSign(Record[2])));
break;
case 2:
Val = GET_OR_DISTINCT(
DISubrange, (Context, getMDOrNull(Record[1]), getMDOrNull(Record[2]),
getMDOrNull(Record[3]), getMDOrNull(Record[4])));
break;
default:
return error("Invalid record: Unsupported version of DISubrange");