Skip to content

Commit f5681b3

Browse files
committed
Add an example to clang attr doc
1 parent 78a37cc commit f5681b3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

clang/include/clang/Basic/AttrDocs.td

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9622,10 +9622,18 @@ not understand a aspect, it must summarily report that the format string has
96229622
that aspect.
96239623

96249624
The compiler reports an aspect by issing a relocation for the symbol
9625-
`<impl_name>_<aspect>``. This arranges for code and data needed to support the
9625+
``<impl_name>_<aspect>``. This arranges for code and data needed to support the
96269626
aspect of the implementation to be brought into the link to satisfy weak
96279627
references in the modular implemenation function.
96289628

9629+
For example, say ``printf`` is annotated with
9630+
``modular_format(__modular_printf, __printf, float)``. Then, a call to
9631+
``printf(var, 42)`` would be untouched. A call to ``printf("%d", 42)`` would
9632+
become a call to ``__modular_printf`` with the same arguments, as would
9633+
``printf("%f", 42.0)``. The latter would be accompanied with a strong
9634+
relocation against the symbol ``__printf_float``, which would bring floating
9635+
point support for ``printf`` into the link.
9636+
96299637
The following aspects are currently supported:
96309638

96319639
- ``float``: The call has a floating point argument

0 commit comments

Comments
 (0)