It has come to my attention that _inside the interface of NSString_, using __attribute__((format_arg(__NSString__, N))) does not work for a method that returns instancetype. This is a pretty specific problem because not a lot of people define NSString. Thankfully, the fix isn't very difficult: if checking an Objective-C method definition, and it returns instancetype, we also check if the class being defined is NSString.
rdar://84729746
You can use ASTContext::getObjCInstanceType, which returns QualType.