Commit Graph

5 Commits

Author SHA1 Message Date
Becca Royal-Gordon
0ef9b7952a [PrintAsObjC] Use NSUInteger if protocol requires
When printing an ObjC member into a header with an `Int` parameter or result, PrintAsClang would look up any imported Objective-C member it overrode to see if ClangImporter imported `NSUInteger` as `Int`, and if so, would print `NSUInteger` instead of `NSInteger`. However, it did not do the same for protocol requirements the member witnessed. Correct this oversight.

Fixes rdar://124300674.
2024-03-08 16:26:10 -08:00
Jordan Rose
33ed767933 [ClangImporter] Preserve the names of imported ObjC properties. (#6182)
This is necessary for proper working of #keyPath, as well as improving
the experience of PrintAsObjC.

rdar://problem/28543037
2017-01-10 13:37:12 -08:00
Jordan Rose
c8c5c643bd [ClangImporter] Also strip "WithError" like we do "AndReturnError".
A few APIs in our frameworks use "WithError" instead, even though it's not
the recommended pattern.

rdar://problem/21212613

Swift SVN r29577
2015-06-23 20:39:53 +00:00
Doug Gregor
b8ad66eb18 PrintAsObjC: Print property getter/setter names when they differ from the defaults.
We were printing getter/setter names when the property came from
Objective-C initially, which is incorrect: we should print them when
the names differ from what Objective-C would compute by default. This
finishes rdar://problem/19408726, which was mostly in place a while
ago.

Swift SVN r28783
2015-05-19 20:38:48 +00:00
Jordan Rose
82c8d9b3dc [PrintAsObjC] Preserve NSUInteger in overridden decls when easy to do.
If a property, method, or subscript overrides an imported property, method,
or subscript that was originally declared using NSUInteger as a property,
parameter, or return type, print the subclass's member using "NSUInteger"
in the generated header to prevent override warnings.

This doesn't handle all cases--in particular, it doesn't handle the
NSUInteger being nested inside a larger type--but it does get the easy
ones correct. I think the easiest way to be more correct would be to mark
NSUInteger-as-Int somehow using a distinct type. (Hidden attribute?
Another typealias? Not sure.)

rdar://problem/19321126

Swift SVN r24771
2015-01-28 01:37:04 +00:00