Skip to content
Commit 6a5f7437 authored by Félix Cloutier's avatar Félix Cloutier
Browse files

format_arg attribute should allow instancetype in NSString definition

- [[format_arg(N)]] tells Clang that a method returns a format string with
  specifiers equivalent to those passed in the string at argument #N. It
  obviously requires the argument and the return type to be strings both.
- `instancetype` is a special return type available in Objective-C class
  definitions that Clang expands to the most-derived statically known type on
  use.
- In Objective-C mode, NSString is allowed in lieu of a C string, both as input
  and output. However, _in the definition of NSString_, Clang rejects format_arg
  on methods that return NSString. This PR addresses this issue by substituting
  `instancetype` with the enclosing definition's type during the validation of
  `format_arg`.

Reviewed By: ahatanak

Differential Revision: https://reviews.llvm.org/D112670

Radar-Id: rdar://84729746
parent db8d7b6e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment