Skip to content

Commit 8641a2c

Browse files
authored
Fix cross-references in Clang attribute reference (llvm#142967)
Anchors are automatically generated, but adding another anchor with the same name hides the anchor that we actually want. Simply removing the unnecessary self-referential anchor `lifetimebound` fixes the links. The documentation for coro_disable_lifetimebound and coro_lifetimebound also had an unnecessary redirection. It's possible to change the link text to differ from the heading, but I think that's not necessary here. Also fix a reference in clang-tidy that was using the (unstable) numbered anchor.
1 parent 79861d2 commit 8641a2c

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

clang-tools-extra/docs/clang-tidy/checks/bugprone/return-const-ref-from-parameter.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ on the control flow of the function, an overload where all problematic
4242

4343
This issue can also be resolved by adding ``[[clang::lifetimebound]]``. Clang
4444
enable ``-Wdangling`` warning by default which can detect mis-uses of the
45-
annotated function. See `lifetimebound attribute <https://clang.llvm.org/docs/AttributeReference.html#id11>`_
45+
annotated function. See `lifetimebound attribute <https://clang.llvm.org/docs/AttributeReference.html#lifetimebound>`_
4646
for details.
4747

4848
.. code-block:: c++

clang/include/clang/Basic/AttrDocs.td

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4396,8 +4396,6 @@ annotated parameter.
43964396
addToSet(str, s); // Not detected.
43974397
}
43984398
}
4399-
4400-
.. _`lifetimebound`: https://clang.llvm.org/docs/AttributeReference.html#lifetimebound
44014399
}];
44024400
}
44034401

@@ -9042,14 +9040,14 @@ def CoroLifetimeBoundDoc : Documentation {
90429040
let Category = DocCatDecl;
90439041
let Content = [{
90449042
The ``[[clang::coro_lifetimebound]]`` is a class attribute which can be applied
9045-
to a coroutine return type (`CRT`_) (i.e.
9043+
to a coroutine return type (`coro_return_type, coro_wrapper`_) (i.e.
90469044
it should also be annotated with ``[[clang::coro_return_type]]``).
90479045

90489046
All parameters of a function are considered to be lifetime bound if the function returns a
90499047
coroutine return type (CRT) annotated with ``[[clang::coro_lifetimebound]]``.
90509048
This lifetime bound analysis can be disabled for a coroutine wrapper or a coroutine by annotating the function
90519049
with ``[[clang::coro_disable_lifetimebound]]`` function attribute .
9052-
See `documentation`_ of ``[[clang::lifetimebound]]`` for details about lifetime bound analysis.
9050+
See documentation of `lifetimebound`_ for details about lifetime bound analysis.
90539051

90549052

90559053
Reference parameters of a coroutine are susceptible to capturing references to temporaries or local variables.
@@ -9109,9 +9107,6 @@ but do not pass them to the underlying coroutine or pass them by value.
91099107
void use() {
91109108
auto task = coro_wrapper(1); // use of temporary is fine as the argument is not lifetime bound.
91119109
}
9112-
9113-
.. _`documentation`: https://clang.llvm.org/docs/AttributeReference.html#lifetimebound
9114-
.. _`CRT`: https://clang.llvm.org/docs/AttributeReference.html#coro-return-type
91159110
}];
91169111
}
91179112

0 commit comments

Comments
 (0)