From f272839e84c9ac2aa7715b5279c30aa3ef7ccadd Mon Sep 17 00:00:00 2001 From: Daniel Thornburgh Date: Wed, 16 Jul 2025 15:19:37 -0700 Subject: [PATCH] Add an example to clang attr doc --- clang/include/clang/Basic/AttrDocs.td | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td index dc98a4d582c6..6fc651dc7cdf 100644 --- a/clang/include/clang/Basic/AttrDocs.td +++ b/clang/include/clang/Basic/AttrDocs.td @@ -9566,10 +9566,18 @@ not understand a aspect, it must summarily report that the format string has that aspect. The compiler reports an aspect by issing a relocation for the symbol -`_``. This arranges for code and data needed to support the +``_``. This arranges for code and data needed to support the aspect of the implementation to be brought into the link to satisfy weak references in the modular implemenation function. +For example, say ``printf`` is annotated with +``modular_format(__modular_printf, __printf, float)``. Then, a call to +``printf(var, 42)`` would be untouched. A call to ``printf("%d", 42)`` would +become a call to ``__modular_printf`` with the same arguments, as would +``printf("%f", 42.0)``. The latter would be accompanied with a strong +relocation against the symbol ``__printf_float``, which would bring floating +point support for ``printf`` into the link. + The following aspects are currently supported: - ``float``: The call has a floating point argument