Skip to content

Commit b34e5c7

Browse files
committed
Fix cross-references in Clang attribute reference
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 43bc5ea commit b34e5c7

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
@@ -4392,8 +4392,6 @@ annotated parameter.
43924392
addToSet(str, s); // Not detected.
43934393
}
43944394
}
4395-
4396-
.. _`lifetimebound`: https://clang.llvm.org/docs/AttributeReference.html#lifetimebound
43974395
}];
43984396
}
43994397

@@ -9038,14 +9036,14 @@ def CoroLifetimeBoundDoc : Documentation {
90389036
let Category = DocCatDecl;
90399037
let Content = [{
90409038
The ``[[clang::coro_lifetimebound]]`` is a class attribute which can be applied
9041-
to a coroutine return type (`CRT`_) (i.e.
9039+
to a coroutine return type (`coro_return_type, coro_wrapper`_) (i.e.
90429040
it should also be annotated with ``[[clang::coro_return_type]]``).
90439041

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

90509048

90519049
Reference parameters of a coroutine are susceptible to capturing references to temporaries or local variables.
@@ -9105,9 +9103,6 @@ but do not pass them to the underlying coroutine or pass them by value.
91059103
void use() {
91069104
auto task = coro_wrapper(1); // use of temporary is fine as the argument is not lifetime bound.
91079105
}
9108-
9109-
.. _`documentation`: https://clang.llvm.org/docs/AttributeReference.html#lifetimebound
9110-
.. _`CRT`: https://clang.llvm.org/docs/AttributeReference.html#coro-return-type
91119106
}];
91129107
}
91139108

0 commit comments

Comments
 (0)