aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Puchert <aaron.puchert@sap.com>2025-06-05 18:17:49 +0200
committerGitHub <noreply@github.com>2025-06-05 18:17:49 +0200
commit8641a2cf99d1424905a6a03656e251fed0fd7ae1 (patch)
treed049b0ee5194a1af418584ae75d6599f962b4ccd
parent79861d2db788867ce6453cbdb7300f18eefd387d (diff)
downloadllvm-8641a2cf99d1424905a6a03656e251fed0fd7ae1.zip
llvm-8641a2cf99d1424905a6a03656e251fed0fd7ae1.tar.gz
llvm-8641a2cf99d1424905a6a03656e251fed0fd7ae1.tar.bz2
Fix cross-references in Clang attribute reference (#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.
-rw-r--r--clang-tools-extra/docs/clang-tidy/checks/bugprone/return-const-ref-from-parameter.rst2
-rw-r--r--clang/include/clang/Basic/AttrDocs.td9
2 files changed, 3 insertions, 8 deletions
diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/return-const-ref-from-parameter.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/return-const-ref-from-parameter.rst
index ba47399..325a0a2 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/bugprone/return-const-ref-from-parameter.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/return-const-ref-from-parameter.rst
@@ -42,7 +42,7 @@ on the control flow of the function, an overload where all problematic
This issue can also be resolved by adding ``[[clang::lifetimebound]]``. Clang
enable ``-Wdangling`` warning by default which can detect mis-uses of the
-annotated function. See `lifetimebound attribute <https://clang.llvm.org/docs/AttributeReference.html#id11>`_
+annotated function. See `lifetimebound attribute <https://clang.llvm.org/docs/AttributeReference.html#lifetimebound>`_
for details.
.. code-block:: c++
diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td
index a16218f..0a9919f 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -4396,8 +4396,6 @@ annotated parameter.
addToSet(str, s); // Not detected.
}
}
-
-.. _`lifetimebound`: https://clang.llvm.org/docs/AttributeReference.html#lifetimebound
}];
}
@@ -9042,14 +9040,14 @@ def CoroLifetimeBoundDoc : Documentation {
let Category = DocCatDecl;
let Content = [{
The ``[[clang::coro_lifetimebound]]`` is a class attribute which can be applied
-to a coroutine return type (`CRT`_) (i.e.
+to a coroutine return type (`coro_return_type, coro_wrapper`_) (i.e.
it should also be annotated with ``[[clang::coro_return_type]]``).
All parameters of a function are considered to be lifetime bound if the function returns a
coroutine return type (CRT) annotated with ``[[clang::coro_lifetimebound]]``.
This lifetime bound analysis can be disabled for a coroutine wrapper or a coroutine by annotating the function
with ``[[clang::coro_disable_lifetimebound]]`` function attribute .
-See `documentation`_ of ``[[clang::lifetimebound]]`` for details about lifetime bound analysis.
+See documentation of `lifetimebound`_ for details about lifetime bound analysis.
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.
void use() {
auto task = coro_wrapper(1); // use of temporary is fine as the argument is not lifetime bound.
}
-
-.. _`documentation`: https://clang.llvm.org/docs/AttributeReference.html#lifetimebound
-.. _`CRT`: https://clang.llvm.org/docs/AttributeReference.html#coro-return-type
}];
}