Skip to content

Commit

Permalink
[DebugInfo][docs] Document DILabel in LangRef
Browse files Browse the repository at this point in the history
Add some minimal documentation for DILabel, originally introduced in
D45024. Update the name and semantics of the `variables:` field in the
documentation for `DISubprogram`; the field is now called
`retainedNodes:` and is a heterogeneous list of `DILocalVariable` and
`DILabel`.

Reviewed By: aprantl

Differential Revision: https://reviews.llvm.org/D89082
  • Loading branch information
slinder1 committed Oct 13, 2020
1 parent f3202b3 commit 3f2386d
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions llvm/docs/LangRef.rst
Expand Up @@ -5045,13 +5045,13 @@ a :ref:`compile unit <DICompileUnit>`.
DISubprogram
""""""""""""

``DISubprogram`` nodes represent functions from the source language. A
distinct ``DISubprogram`` may be attached to a function definition using
``!dbg`` metadata. A unique ``DISubprogram`` may be attached to a function
declaration used for call site debug info. The ``variables:`` field points at
:ref:`variables <DILocalVariable>` that must be retained, even if their IR
counterparts are optimized out of the IR. The ``type:`` field must point at an
:ref:`DISubroutineType`.
``DISubprogram`` nodes represent functions from the source language. A distinct
``DISubprogram`` may be attached to a function definition using ``!dbg``
metadata. A unique ``DISubprogram`` may be attached to a function declaration
used for call site debug info. The ``retainedNodes:`` field is a list of
:ref:`variables <DILocalVariable>` and :ref:`labels <DILabel>` that must be
retained, even if their IR counterparts are optimized out of the IR. The
``type:`` field must point at an :ref:`DISubroutineType`.

.. _DISubprogramDeclaration:

Expand All @@ -5074,7 +5074,8 @@ and ``scope:``.
virtuality: DW_VIRTUALITY_pure_virtual,
virtualIndex: 10, flags: DIFlagPrototyped,
isOptimized: true, unit: !5, templateParams: !6,
declaration: !7, variables: !8, thrownTypes: !9)
declaration: !7, retainedNodes: !8,
thrownTypes: !9)

.. _DILexicalBlock:

Expand Down Expand Up @@ -5299,6 +5300,22 @@ appear in the included source file.
!2 = !DIMacroFile(macinfo: DW_MACINFO_start_file, line: 7, file: !2,
nodes: !3)

.. _DILabel:

DILabel
"""""""

``DILabel`` nodes represent labels within a :ref:`DISubprogram`. All fields of
a ``DILabel`` are mandatory. The ``scope:`` field must be one of either a
:ref:`DILexicalBlockFile`, a :ref:`DILexicalBlock`, or a :ref:`DISubprogram`.
The ``name:`` field is the label identifier. The ``file:`` field is the
:ref:`DIFile` the label is present in. The ``line:`` field is the source line
within the file where the label is declared.

.. code-block:: text

!2 = !DILabel(scope: !0, name: "foo", file: !1, line: 7)

'``tbaa``' Metadata
^^^^^^^^^^^^^^^^^^^

Expand Down

0 comments on commit 3f2386d

Please sign in to comment.