Skip to content

Commit 753b076

Browse files
committed
Add an example to clang attr doc
1 parent dbd48a1 commit 753b076

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

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

9659+
For example, say ``printf`` is annotated with
9660+
``modular_format(__modular_printf, __printf, float)``. Then, a call to
9661+
``printf(var, 42)`` would be untouched. A call to ``printf("%d", 42)`` would
9662+
become a call to ``__modular_printf`` with the same arguments, as would
9663+
``printf("%f", 42.0)``. The latter would be accompanied with a strong
9664+
relocation against the symbol ``__printf_float``, which would bring floating
9665+
point support for ``printf`` into the link.
9666+
96599667
The following aspects are currently supported:
96609668

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

0 commit comments

Comments
 (0)