[PATCH] D112579: Allow non-variadic functions to be attributed with `__attribute__((format))`

FĂ©lix Cloutier via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 1 08:47:56 PDT 2022


fcloutier updated this revision to Diff 441703.
fcloutier set the repository for this revision to rG LLVM Github Monorepo.
fcloutier added a comment.

Thanks, Aaron. I wasn't sure how to follow up given how long it had been since the review started. I understand that we're all busy (which explains the week delay on my part here as well).

I've addressed all of your comments except the one on this bit <https://reviews.llvm.org/D112579#inline-1231865>:

  if (const FunctionType *FnTy = D->getFunctionType())
    IsVariadic = cast<FunctionProtoType>(FnTy)->isVariadic();

The proposed change isn't identical because `D->getFunctionType()` can return nullptr (for instance, if `D` is a `BlockDecl`). However, in the case `FnTy` isn't nullptr, then it is guaranteed to be a `FunctionProtoType` as the attribute is rejected on functions without a prototype.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112579/new/

https://reviews.llvm.org/D112579

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/FormatString.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/Sema/attr-format.c
  clang/test/Sema/format-strings.c
  clang/test/SemaCXX/attr-format.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112579.441703.patch
Type: text/x-patch
Size: 48027 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220701/fc9cbc31/attachment-0001.bin>


More information about the cfe-commits mailing list