Skip to content

Commit 7730cb0

Browse files
committed
Add an example to clang attr doc
1 parent 16bd562 commit 7730cb0

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

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

9451+
For example, say ``printf`` is annotated with
9452+
``modular_format(__modular_printf, __printf, float)``. Then, a call to
9453+
``printf(var, 42)`` would be untouched. A call to ``printf("%d", 42)`` would
9454+
become a call to ``__modular_printf`` with the same arguments, as would
9455+
``printf("%f", 42.0)``. The latter would be accompanied with a strong
9456+
relocation against the symbol ``__printf_float``, which would bring floating
9457+
point support for ``printf`` into the link.
9458+
94519459
The following aspects are currently supported:
94529460

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

0 commit comments

Comments
 (0)