aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineBasicBlock.cpp
diff options
context:
space:
mode:
authorapple-fcloutier <75502309+apple-fcloutier@users.noreply.github.com>2025-02-24 18:58:59 -0800
committerGitHub <noreply@github.com>2025-02-24 18:58:59 -0800
commitc7101188fb3f17176e9152b1d733da6d7199d317 (patch)
tree38867cf19f6d8f4b1392125b8ac52b0ee9efaac3 /llvm/lib/CodeGen/MachineBasicBlock.cpp
parent253e11695ba8d77e4339d0c43758f192b149db1e (diff)
downloadllvm-c7101188fb3f17176e9152b1d733da6d7199d317.zip
llvm-c7101188fb3f17176e9152b1d733da6d7199d317.tar.gz
llvm-c7101188fb3f17176e9152b1d733da6d7199d317.tar.bz2
[clang] Implement __attribute__((format_matches)) (#116708)
This implements ``__attribute__((format_matches))``, as described in the RFC: https://discourse.llvm.org/t/rfc-format-attribute-attribute-format-like/83076 The ``format`` attribute only allows the compiler to check that a format string matches its arguments. If the format string is passed independently of its arguments, there is no way to have the compiler check it. ``format_matches(flavor, fmtidx, example)`` allows the compiler to check format strings against the ``example`` format string instead of against format arguments. See the changes to AttrDocs.td in this diff for more information. Implementation-wise, this change subclasses CheckPrintfHandler and CheckScanfHandler to allow them to collect specifiers into arrays, and implements comparing that two specifiers are equivalent. `checkFormatStringExpr` gets a new `ReferenceFormatString` argument that is piped down when calling a function with the `format_matches` attribute (and is `nullptr` otherwise); this is the string that the actual format string is compared against. Although this change does not enable -Wformat-nonliteral by default, IMO, all the pieces are now in place such that it could be.
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
0 files changed, 0 insertions, 0 deletions