Skip to content

Commit 1b9cdfd

Browse files
committed
Clarify and correct docs
1 parent 51b2ad3 commit 1b9cdfd

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

clang/include/clang/Basic/AttrDocs.td

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9680,23 +9680,24 @@ def ModularFormatDocs : Documentation {
96809680
let Content = [{
96819681
The ``modular_format`` attribute can be applied to a function that bears the
96829682
``format`` attribute (or standard library functions) to indicate that the
9683-
implementation is modular on the format string argument. When the format string
9684-
for a given call is constant, the compiler may redirect the call to the symbol
9685-
given as the first argument to the attribute (the modular implementation
9686-
function).
9683+
implementation is "modular", that is, that the implemenation is logically
9684+
divided into a number of named aspects. When the compiler can determine that
9685+
not all aspects of the implementation are needed for a given call, the compiler
9686+
may redirect the call to the identifier given as the first argument to the
9687+
attribute (the modular implementation function).
96879688

96889689
The second argument is a implementation name, and the remaining arguments are
96899690
aspects of the format string for the compiler to report. If the compiler does
9690-
not understand an aspect, it must summarily report that the format string has
9691-
that aspect.
9691+
not understand an aspect, it must summarily consider any call to require that
9692+
aspect.
96929693

9693-
The compiler reports an aspect by issuing a relocation for the symbol
9694-
``<impl_name>_<aspect>``. This arranges for code and data needed to support the
9695-
aspect of the implementation to be brought into the link to satisfy weak
9696-
references in the modular implemenation function.
9694+
The compiler reports that a call requires an aspect by issuing a relocation for
9695+
the symbol ``<impl_name>_<aspect>`` at the point of the call. This arranges for
9696+
code and data needed to support the aspect of the implementation to be brought
9697+
into the link to satisfy weak references in the modular implemenation function.
96979698

96989699
For example, say ``printf`` is annotated with
9699-
``modular_format(__modular_printf, __printf, float)``. Then, a call to
9700+
``modular_format(__modular_printf, "__printf", "float")``. Then, a call to
97009701
``printf(var, 42)`` would be untouched. A call to ``printf("%d", 42)`` would
97019702
become a call to ``__modular_printf`` with the same arguments, as would
97029703
``printf("%f", 42.0)``. The latter would be accompanied with a strong

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6927,7 +6927,6 @@ static void handleModularFormat(Sema &S, Decl *D, const ParsedAttr &AL) {
69276927
llvm::sort(Aspects);
69286928
Aspects.erase(llvm::unique(Aspects), Aspects.end());
69296929

6930-
// TODO: Type checking on identifier
69316930
D->addAttr(::new (S.Context) ModularFormatAttr(
69326931
S.Context, AL, AL.getArgAsIdent(0)->getIdentifierInfo(), ImplName,
69336932
Aspects.data(), Aspects.size()));

0 commit comments

Comments
 (0)