Commit Graph

753 Commits

Author SHA1 Message Date
Fariborz Jahanian ac8dbf0fc7 objcetive-c-arc: When overriding a method, its ns_consumed patameter
attribute must match its overriden method. Same also for
ns_returns_retained/not_retained on the result type.
This is one half of // rdar://10187884

llvm-svn: 140649
2011-09-27 22:35:36 +00:00
Douglas Gregor 486b74e596 Revert r139989 and r140031, which implemented the Objective-C type
system change in <rdar://problem/10109725> that allows conversion from
'self' in class methods to the root of the class's hierarchy. This
conversion rule is a hack that has non-trivial repurcussions
(particularly with overload resolution).

llvm-svn: 140605
2011-09-27 16:10:05 +00:00
Fariborz Jahanian 698bd3113e objc - don't complain about unimplemented property when conforming
protocol declares the property, as well as one of its superclasses.
Property will be implemented in the super class. // rdar://10120691

llvm-svn: 140586
2011-09-27 00:23:52 +00:00
Fariborz Jahanian 23ef165920 objc - in matching setter argument type to its property type,
ingore the type qualifiers. // rdar://10156674

llvm-svn: 140571
2011-09-26 22:12:27 +00:00
Fariborz Jahanian 6d5d6a277a objc-arc: mark functions which return types which can't be dealt with
in arc mode and are in system headers as unavailable. 
// rdar://10186625

llvm-svn: 140565
2011-09-26 21:23:35 +00:00
Benjamin Kramer 6f4f307d1f Turns out we tested for this typo.
llvm-svn: 140513
2011-09-26 02:32:23 +00:00
Fariborz Jahanian 11ee283e2a objc - redeclaration of property in extension class
must match property type declaration in its
primary class. // rdar://10142679

llvm-svn: 140438
2011-09-24 00:56:59 +00:00
Fariborz Jahanian 44653709fd objc - fixes a crash when undefined typed property
followed by it implementation crashes when attempt
is made to access the synthesized ivar. 
// rdar://10177744

llvm-svn: 140432
2011-09-23 23:11:38 +00:00
Douglas Gregor 83dea558bc Add a test triple. Who knew that all the world wasn't darwin?
llvm-svn: 140408
2011-09-23 20:28:32 +00:00
Douglas Gregor b1fa148837 Don't propagate the 'availability' attribute through declaration
merging for overrides. One might want to make a method's availability
in a superclass different from that of its subclass. Fixes
<rdar://problem/10166223>.

llvm-svn: 140406
2011-09-23 20:23:42 +00:00
Douglas Gregor 0c254a00c1 Clean up parsing the category names in interfaces slightly, using
MatchRHSPunctuation appropriately and giving a useful source location
for the complaint about attributes being added to a category.

llvm-svn: 140404
2011-09-23 19:19:41 +00:00
Argyrios Kyrtzidis 712512bb36 [ARC] Allow forming 'id*' in an unevaluated context. Fixes rdar://10148540.
llvm-svn: 140212
2011-09-20 23:49:22 +00:00
Fariborz Jahanian db8015c449 objc - Treat type of 'self' in class methods as root of
class of this method. // rdar://10109725

llvm-svn: 139989
2011-09-17 19:23:40 +00:00
Fariborz Jahanian 8b148bb5b7 objc: Don't crash with decl context for property impl.
is missing. // rdar//10127639

llvm-svn: 139988
2011-09-17 18:48:50 +00:00
Fariborz Jahanian d923eb0d1e reverse patch in r139818 to focus on 'self'
instead of 'Class'.

llvm-svn: 139834
2011-09-15 20:40:18 +00:00
Fariborz Jahanian b7d278ba77 Objective-c: Conversion from type Class to any root class type is allowed
in class methods with no warning. //rdar://10109725

llvm-svn: 139818
2011-09-15 18:30:22 +00:00
Fariborz Jahanian 1723e17b78 objc-arc: warn when a 'retain' block property is
declared which does not force a 'copy' of the block literal
object. // rdar://9829425

llvm-svn: 139706
2011-09-14 18:03:46 +00:00
David Blaikie e5f9a9e603 Show either a location or a fixit note, not both, for uninitialized variable warnings.
llvm-svn: 139463
2011-09-10 05:35:08 +00:00
Douglas Gregor 97e3590a6e Fix a diagnostics crasher with -Wmissing-noreturn in Objective-C
methods, and improve the diagnostic slightly along the way. Fixes
<rdar://problem/10098695>.

llvm-svn: 139446
2011-09-10 00:56:20 +00:00
Douglas Gregor 3168dcf134 The integer type of an enumeration type isn't always canonical
llvm-svn: 139334
2011-09-08 23:29:05 +00:00
Douglas Gregor 8b7d403684 Allow C++0x enumerations with a fixed underlying type in
Objective-C. The @encode'ing of such an enumeration type is the same
as its underlying type. <rdar://problem/5276348>.

llvm-svn: 139297
2011-09-08 17:18:35 +00:00
Douglas Gregor bab8a96f2f Implement the Objective-C 'instancetype' type, which is an alias of
'id' that can be used (only!) via a contextual keyword as the result
type of an Objective-C message send. 'instancetype' then gives the
method a related result type, which we have already been inferring for
a variety of methods (new, alloc, init, self, retain). Addresses
<rdar://problem/9267640>.

llvm-svn: 139275
2011-09-08 01:46:34 +00:00
Fariborz Jahanian eebdb67420 objc-gc: More sema work for properties declared 'weak'
in GC mode. // rdar://10073896

llvm-svn: 139235
2011-09-07 16:24:21 +00:00
Fariborz Jahanian b93cd18a82 Test for default property synthesis.
llvm-svn: 138917
2011-08-31 23:32:48 +00:00
Fariborz Jahanian 97d744bea4 objective-c: this patch (re)introduces objective-c's default property
synthesis. This new feature is currently placed under 
-fobjc-default-synthesize-properties option
and is off by default pending further testing.
It will become the default feature soon. 
// rdar://8843851

llvm-svn: 138913
2011-08-31 22:24:06 +00:00
Fariborz Jahanian bd0642fede objective-c - This patch buffers method implementations
and does the Sema on their body after the entire 
class/category @implementation is seen. This change allows messaging 
of forward private methods, as well as, access to 
synthesized ivars of properties with foward synthesize
declarations; among others. In effect, this patch removes
several restrictions placed on objective-c due to in-place
semantics processing of methods.
This is part of // rdar://8843851.

llvm-svn: 138865
2011-08-31 17:37:55 +00:00
Chandler Carruth c841b6e598 Improve the diagnostic text for -Wmissing-noreturn to include the name
of the function in question when applicable (that is, not for blocks).
Patch by Joerg Sonnenberger with some stylistic tweaks by me.

When discussing this weth Joerg, streaming the decl directly into the
diagnostic didn't work because we have a pointer-to-const, and the
overload doesn't accept such. In order to make my style tweaks to the
patch, I first changed the overload to accept a pointer-to-const, and
then changed the diagnostic printing layer to also use
a pointer-to-const, cleaning up a gross line of code along the way.

llvm-svn: 138854
2011-08-31 09:01:53 +00:00
Fariborz Jahanian 59b75285f6 objc - fixes a regression in declaring c decls nested in
objective-c containers due to recent changes to objc decl 
contexts. // rdar://10041908

llvm-svn: 138803
2011-08-30 17:10:52 +00:00
Nico Weber f926a45df5 Do not warn about [super finalize] in arc mode.
llvm-svn: 138776
2011-08-29 22:59:14 +00:00
Nico Weber 1fb82667dd Warn on missing [super finalize] calls.
This matches gcc's logic. Second half of PR10661.

llvm-svn: 138730
2011-08-28 22:35:17 +00:00
Fariborz Jahanian 83aa8ab3ae objective-c - Make warning on unimplemented protocols point
to class implementation where it is supposed to be
implemented. // rdar://10009982.

llvm-svn: 138714
2011-08-27 21:55:47 +00:00
Fariborz Jahanian 97b6ac5407 objc-arc: Mention property's attribute by name when
finding life-time conflict with its declared ivar.
// rdar://10007230

llvm-svn: 138659
2011-08-26 21:21:19 +00:00
Fariborz Jahanian 5cc730cdef Don't warn on category implementing a method, if
declated method in the class belongs to a synthesized
property getter/setter. // rdar://10014946

llvm-svn: 138598
2011-08-25 22:58:42 +00:00
Fariborz Jahanian 73952fc263 objc - fix up the builtin type for objc_assign_ivar.
// rdar://9362887.

llvm-svn: 138412
2011-08-23 23:33:09 +00:00
Ted Kremenek 618e574253 Do not perform check for missing '[super dealloc]' under ARC as calling -dealloc is illegal in that mode.
llvm-svn: 138261
2011-08-22 19:07:43 +00:00
Nico Weber 715abaf213 Warn on missing [super dealloc] calls.
This matches gcc's logic. Half of PR10661.

llvm-svn: 138240
2011-08-22 17:25:57 +00:00
Fariborz Jahanian 8d382dc781 Restore patch I reversed in r138040. Known buildbot
failures are resolved.

llvm-svn: 138234
2011-08-22 15:54:49 +00:00
Fariborz Jahanian 7e47de3156 objc-arc: @property definitions should default to (strong) when not
specified. // rdar://9971982

llvm-svn: 138062
2011-08-19 19:28:44 +00:00
NAKAMURA Takumi 9f8a02d34e De-Unicode-ify.
llvm-svn: 137430
2011-08-12 05:49:51 +00:00
Fariborz Jahanian 3c12dd7675 objective-c: Using existing infrastructure for finding
overridden  methods to diagnose their type mismatch.
This is a general solution for previous fixes
for // rdar://6191214 and // rdar://9352731
and removes lots of duplicate code.

llvm-svn: 137222
2011-08-10 17:16:30 +00:00
Fariborz Jahanian 5ac085ab3a objective-c: diagnose protocol inconsistencies in following
situation. When a class explicitly or implicitly (through inheritance) 
"conformsTo" two protocols which conflict (have methods which conflict).
This patch fixes the previous patch where warnings were coming out in
non-deterministic order.  This is 2nd part of // rdar://6191214.

llvm-svn: 137055
2011-08-08 18:03:17 +00:00
John McCall 5939b16135 Do l-value conversion, etc., on a switch condition expression in
ActOnStartOfSwitchStmt (i.e. before binding up a full-expression)
instead of ActOnFinishSwitchStmt.

Among other things, this means that property l-values are properly
converted inside the full-expression.

llvm-svn: 137014
2011-08-06 07:30:58 +00:00
Ted Kremenek 1cd34b8fea Revert 136984 and 136927.
llvm-svn: 136998
2011-08-05 23:31:22 +00:00
Ted Kremenek 9dd9b882ae Make test/SemaObjC/qualified-protocol-method-conflicts.m always fail and mark it XFAIL. This is a stop gap until the output of the test is deterministic.
llvm-svn: 136984
2011-08-05 21:53:47 +00:00
Fariborz Jahanian 6a86844161 objective-c: diagnose protocol inconsistencies in following
situation. When a class explicitly or implicitly (through inheritance) 
"conformsTo" two protocols which conflict (have methods which conflict).
This is 2nd part of // rdar://6191214.

llvm-svn: 136927
2011-08-04 21:28:44 +00:00
Fariborz Jahanian 2bda1b65b1 objective-c: Methods declared in methods must type match
those declated in its protocols. First half or // rdar://6191214

llvm-svn: 136794
2011-08-03 18:21:12 +00:00
Fariborz Jahanian e1506cbfda objective-c: reverse patch for // rdar://9818354
llvm-svn: 136658
2011-08-01 22:39:49 +00:00
Douglas Gregor 7e1eb935db When complaining about a non-POD second argument to va_arg, use a
special diagnostic for ARC ownership-qualified types. We wouldn't want
to expose Objective-C programmers to the term "POD", would we? Fixes
<rdar://problem/9772982>.

llvm-svn: 136558
2011-07-30 06:45:27 +00:00
Fariborz Jahanian 9f8b19e9ae objective-c: warn if implementation of a method in category
masks an existing method in its primary class, class extensions,
and primary class's non-optional protocol methods; as primary
class, or one of its subclass's will implement this method.
This warning has potential of being noisy so it has its own
group.  // rdar://7020493

llvm-svn: 136426
2011-07-28 23:19:50 +00:00
Anna Zaks 3b402716b1 Add */& mismatch fixit generation to the Sema::DiagnoseAssignmentResult().
llvm-svn: 136379
2011-07-28 19:51:27 +00:00