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
Loading
Please sign in to comment