[all-commits] [llvm/llvm-project] 12ab3e: format_arg attribute does not support nullable ins...

apple-fcloutier via All-commits all-commits at lists.llvm.org
Fri Nov 12 13:41:24 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 12ab3e6c8402078f58959847277858eb47a43a19
      https://github.com/llvm/llvm-project/commit/12ab3e6c8402078f58959847277858eb47a43a19
  Author: FĂ©lix Cloutier <fcloutier at apple.com>
  Date:   2021-11-12 (Fri, 12 Nov 2021)

  Changed paths:
    M clang/lib/Sema/SemaDeclAttr.cpp
    M clang/test/SemaObjC/format-arg-attribute.m

  Log Message:
  -----------
  format_arg attribute does not support nullable instancetype return type

* The format_arg attribute tells the compiler that the attributed function
  returns a format string that is compatible with a format string that is being
  passed as a specific argument.
* Several NSString methods return copies of their input, so they would ideally
  have the format_arg attribute. A previous differential (D112670) added
  support for instancetype methods having the format_arg attribute when used
  in the context of NSString method declarations.
* D112670 failed to account that instancetype can be sugared in certain narrow
  (but critical) scenarios, like by using nullability specifiers. This patch
  resolves this problem.

Differential Revision: https://reviews.llvm.org/D113636
Reviewed By: ahatanak

Radar-Id: rdar://85278860




More information about the All-commits mailing list