Skip to content

Commit 0939663

Browse files
committed
Clarify and correct docs
1 parent 2f524fa commit 0939663

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
@@ -9641,23 +9641,24 @@ def ModularFormatDocs : Documentation {
96419641
let Content = [{
96429642
The ``modular_format`` attribute can be applied to a function that bears the
96439643
``format`` attribute (or standard library functions) to indicate that the
9644-
implementation is modular on the format string argument. When the format string
9645-
for a given call is constant, the compiler may redirect the call to the symbol
9646-
given as the first argument to the attribute (the modular implementation
9647-
function).
9644+
implementation is "modular", that is, that the implemenation is logically
9645+
divided into a number of named aspects. When the compiler can determine that
9646+
not all aspects of the implementation are needed for a given call, the compiler
9647+
may redirect the call to the identifier given as the first argument to the
9648+
attribute (the modular implementation function).
96489649

96499650
The second argument is a implementation name, and the remaining arguments are
96509651
aspects of the format string for the compiler to report. If the compiler does
9651-
not understand an aspect, it must summarily report that the format string has
9652-
that aspect.
9652+
not understand an aspect, it must summarily consider any call to require that
9653+
aspect.
96539654

9654-
The compiler reports an aspect by issuing a relocation for the symbol
9655-
``<impl_name>_<aspect>``. This arranges for code and data needed to support the
9656-
aspect of the implementation to be brought into the link to satisfy weak
9657-
references in the modular implemenation function.
9655+
The compiler reports that a call requires an aspect by issuing a relocation for
9656+
the symbol ``<impl_name>_<aspect>`` at the point of the call. This arranges for
9657+
code and data needed to support the aspect of the implementation to be brought
9658+
into the link to satisfy weak references in the modular implemenation function.
96589659

96599660
For example, say ``printf`` is annotated with
9660-
``modular_format(__modular_printf, __printf, float)``. Then, a call to
9661+
``modular_format(__modular_printf, "__printf", "float")``. Then, a call to
96619662
``printf(var, 42)`` would be untouched. A call to ``printf("%d", 42)`` would
96629663
become a call to ``__modular_printf`` with the same arguments, as would
96639664
``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
@@ -6799,7 +6799,6 @@ static void handleModularFormat(Sema &S, Decl *D, const ParsedAttr &AL) {
67996799
llvm::sort(Aspects);
68006800
Aspects.erase(llvm::unique(Aspects), Aspects.end());
68016801

6802-
// TODO: Type checking on identifier
68036802
D->addAttr(::new (S.Context) ModularFormatAttr(
68046803
S.Context, AL, AL.getArgAsIdent(0)->getIdentifierInfo(), ImplName,
68056804
Aspects.data(), Aspects.size()));

0 commit comments

Comments
 (0)