Commit Graph

8 Commits

Author SHA1 Message Date
Manman Ren b7fda4baa9 ObjectiveC: canonicalize "kindof id" to "id".
There is no need to apply kindof on an unqualified id type.

rdar://24753825

llvm-svn: 270241
2016-05-20 17:29:43 +00:00
Manman Ren c46f7d1883 ObjC kindof: set the type of a conditional expression when involving kindof.
When either LHS or RHS is a kindof type, we return a kindof type.

rdar://problem/20513780

llvm-svn: 268781
2016-05-06 19:35:02 +00:00
Manman Ren 051d0b620d ObjC kindof: order the methods in global pool relative to availability.
r265877 tries to put methods that are deprecated or unavailable to the
front of the global pool to emit diagnostics, but it breaks some of
our existing codes that depend on choosing a certain method for id
lookup.

This commit orders the methods with the same declaration with respect
to the availability, but do not order methods with different declaration.

rdar://25707511

llvm-svn: 266264
2016-04-13 23:43:56 +00:00
Manman Ren 71224530c1 ObjC kindof: check the context when inserting methods to global pool.
To make kindof lookup work, we need to insert methods with different
context into the global pool, even though they have the same siganture.

Since diagnosis of availability is performed on the best candidate,
which is often the first candidate from the global pool, we prioritize
the methods that are unavaible or deprecated to the head of the list.

Since we now have more methods in the global pool, we need to watch
out for performance impact.

rdar://25635831

llvm-svn: 265877
2016-04-09 18:59:48 +00:00
Manman Ren 7ed4f988c1 [ObjC kindof] Use type bound to filter out the candidate methods.
rdar://21306753

llvm-svn: 265712
2016-04-07 19:32:24 +00:00
Akira Hatanaka 8ebd580cf5 [Objective-c] Fix a crash that occurs when ObjCTypeParamList::back() is
called on an empty list.

This commit makes Parser::parseObjCTypeParamListOrProtocolRefs return
nullptr if it sees an invalid type parameter (e.g., __kindof) in the
type parameter list.

rdar://problem/23068920

Differential Revision: http://reviews.llvm.org/D15463

llvm-svn: 255754
2015-12-16 06:25:38 +00:00
Douglas Gregor 89442bbb79 s/__nonnull/_Nonnull in a test for Objective-C __kindof.
llvm-svn: 241563
2015-07-07 06:20:41 +00:00
Douglas Gregor ab209d83be Implement the Objective-C __kindof type qualifier.
The __kindof type qualifier can be applied to Objective-C object
(pointer) types to indicate id-like behavior, which includes implicit
"downcasting" of __kindof types to subclasses and id-like message-send
behavior. __kindof types provide better type bounds for substitutions
into unspecified generic types, which preserves more type information.

llvm-svn: 241548
2015-07-07 03:58:42 +00:00