Skip to content

Commit f272839

Browse files
committed
Add an example to clang attr doc
1 parent 46a0008 commit f272839

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
@@ -9566,10 +9566,18 @@ not understand a aspect, it must summarily report that the format string has
95669566
that aspect.
95679567

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

9573+
For example, say ``printf`` is annotated with
9574+
``modular_format(__modular_printf, __printf, float)``. Then, a call to
9575+
``printf(var, 42)`` would be untouched. A call to ``printf("%d", 42)`` would
9576+
become a call to ``__modular_printf`` with the same arguments, as would
9577+
``printf("%f", 42.0)``. The latter would be accompanied with a strong
9578+
relocation against the symbol ``__printf_float``, which would bring floating
9579+
point support for ``printf`` into the link.
9580+
95739581
The following aspects are currently supported:
95749582

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

0 commit comments

Comments
 (0)