@@ -6319,21 +6319,24 @@ The following ``tag:`` values are valid:
63196319 DW_TAG_union_type = 23
63206320
63216321For ``DW_TAG_array_type``, the ``elements:`` should be :ref:`subrange
6322- descriptors <DISubrange>`, each representing the range of subscripts at that
6323- level of indexing. The ``DIFlagVector`` flag to ``flags:`` indicates that an
6324- array type is a native packed vector. The optional ``dataLocation`` is a
6325- DIExpression that describes how to get from an object's address to the actual
6326- raw data, if they aren't equivalent. This is only supported for array types,
6327- particularly to describe Fortran arrays, which have an array descriptor in
6328- addition to the array data. Alternatively it can also be DIVariable which
6329- has the address of the actual raw data. The Fortran language supports pointer
6330- arrays which can be attached to actual arrays, this attachment between pointer
6331- and pointee is called association. The optional ``associated`` is a
6332- DIExpression that describes whether the pointer array is currently associated.
6333- The optional ``allocated`` is a DIExpression that describes whether the
6334- allocatable array is currently allocated. The optional ``rank`` is a
6335- DIExpression that describes the rank (number of dimensions) of fortran assumed
6336- rank array (rank is known at runtime).
6322+ descriptors <DISubrange>` or :ref:`subrange descriptors
6323+ <DISubrangeType>`, each representing the range of subscripts at that
6324+ level of indexing. The ``DIFlagVector`` flag to ``flags:`` indicates
6325+ that an array type is a native packed vector. The optional
6326+ ``dataLocation`` is a DIExpression that describes how to get from an
6327+ object's address to the actual raw data, if they aren't
6328+ equivalent. This is only supported for array types, particularly to
6329+ describe Fortran arrays, which have an array descriptor in addition to
6330+ the array data. Alternatively it can also be DIVariable which has the
6331+ address of the actual raw data. The Fortran language supports pointer
6332+ arrays which can be attached to actual arrays, this attachment between
6333+ pointer and pointee is called association. The optional
6334+ ``associated`` is a DIExpression that describes whether the pointer
6335+ array is currently associated. The optional ``allocated`` is a
6336+ DIExpression that describes whether the allocatable array is currently
6337+ allocated. The optional ``rank`` is a DIExpression that describes the
6338+ rank (number of dimensions) of fortran assumed rank array (rank is
6339+ known at runtime).
63376340
63386341For ``DW_TAG_enumeration_type``, the ``elements:`` should be :ref:`enumerator
63396342descriptors <DIEnumerator>`, each representing the definition of an enumeration
@@ -6378,6 +6381,50 @@ DISubrange
63786381 !12 = !DIGlobalVariable(name: "count", scope: !8, file: !6, line: 22, type: !9)
63796382 !13 = !DISubrange(count: !12, lowerBound: 0)
63806383
6384+ .. _DISubrangeType:
6385+
6386+ DISubrangeType
6387+ """"""""""""""
6388+
6389+ ``DISubrangeType`` is similar to ``DISubrange``, but it is also a
6390+ ``DIType``. It may be used as the type of an object, but could also
6391+ be used as an array index.
6392+
6393+ Like ``DISubrange``, it can hold a lower bound and count, or a lower
6394+ bound and upper bound. A ``DISubrangeType`` refers to the underlying
6395+ type of which it is a subrange; this type can be an integer type or an
6396+ enumeration type.
6397+
6398+ A ``DISubrangeType`` may also have a stride -- unlike ``DISubrange``,
6399+ this stride is a bit stride. The stride is only useful when a
6400+ ``DISubrangeType`` is used as an array index type.
6401+
6402+ Finally, ``DISubrangeType`` may have a bias. In Ada, a program can
6403+ request that a subrange value be stored in the minimum number of bits
6404+ required. In this situation, the stored value is biased by the lower
6405+ bound -- e.g., a range ``-7 .. 0`` may take 3 bits in memory, and the
6406+ value -5 would be stored as 2 (a bias of -7).
6407+
6408+ .. code-block:: text
6409+
6410+ ; Scopes used in rest of example
6411+ !0 = !DIFile(filename: "vla.c", directory: "/path/to/file")
6412+ !1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !0)
6413+ !2 = distinct !DISubprogram(name: "foo", scope: !1, file: !0, line: 5)
6414+
6415+ ; Base type used in example.
6416+ !3 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
6417+
6418+ ; A simple subrange with a name.
6419+ !4 = !DISubrange(name: "subrange", file: !0, line: 17, size: 32,
6420+ align: 32, baseType: !3, lowerBound: 18, count: 12)
6421+ ; A subrange with a bias.
6422+ !5 = !DISubrange(name: "biased", lowerBound: -7, upperBound: 0,
6423+ bias: -7, size: 3)
6424+ ; A subrange with a bit stride.
6425+ !6 = !DISubrange(name: "biased", lowerBound: 0, upperBound: 7,
6426+ stride: 3)
6427+
63816428.. _DIEnumerator:
63826429
63836430DIEnumerator
0 commit comments