Commit Graph

796 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis fed29142ba When applying ARC __weak to a non-objc pointer, do not give error that
__weak is unsupported by the deployment target, since it is going to be
ignored anyway.

Makes it easier for incremental migration from GC.

llvm-svn: 143975
2011-11-07 18:40:21 +00:00
Fariborz Jahanian 37c6417949 objc: fixed enum type is supported in objc mode.
Fixes a bug where enumerator type is not this
fixed type. // rdar://10381507

llvm-svn: 143724
2011-11-04 18:51:24 +00:00
Fariborz Jahanian 3018b95093 objc: warn if a readonly property has a setter attribute too.
// rdar://10357768

llvm-svn: 143518
2011-11-01 23:02:16 +00:00
Ted Kremenek 5d6044e413 Downgrade err_iboutlet_object_type to a warning. It was breaking a bunch of code. We will reconsider promoting it back to an error later.
llvm-svn: 143470
2011-11-01 18:08:35 +00:00
Fariborz Jahanian d01ddd1d07 Improve text of a diagnostic.
llvm-svn: 143353
2011-10-31 17:27:06 +00:00
Fariborz Jahanian 244b187d22 objc-arc: desugar certain type and improve on diagnostic for
ownership qualifier cast which won't work.
// rdar://10244607

llvm-svn: 143258
2011-10-29 00:06:10 +00:00
Argyrios Kyrtzidis 729387327b [ARC] Do not transfer ARC ownership if the cast is going to result in r-value,
in which case the ownership is redundant. Thanks to John for the suggestion.

llvm-svn: 143240
2011-10-28 22:54:28 +00:00
Fariborz Jahanian 2fa646d596 objective-c arc: type-casting of an objc pointer to
an rvalue retainable object type with life-time qualifier has no
effect and wil be diagnosed as error. // rdar://10244607

llvm-svn: 143219
2011-10-28 20:06:07 +00:00
Argyrios Kyrtzidis a9aabf7d51 Fix crash on an @interface nested inside @implementation, rdar://10336158
llvm-svn: 143085
2011-10-27 00:09:34 +00:00
John McCall 526ab47a55 Restore r142914 and r142915, now with missing file and apparent
GCC compiler workaround.

llvm-svn: 142931
2011-10-25 17:37:35 +00:00
NAKAMURA Takumi 9a8f13961c Revert r142914 and r142915, due to possibly missing file.
r142914: "Introduce a placeholder type for "pseudo object""
r142915: "Pull the pseudo-object stuff into its own file."
llvm-svn: 142921
2011-10-25 14:32:25 +00:00
John McCall c4a2d3259f Introduce a placeholder type for "pseudo object"
expressions: expressions which refer to a logical rather
than a physical l-value, where the logical object is
actually accessed via custom getter/setter code.
A subsequent patch will generalize the AST for these
so that arbitrary "implementing" sub-expressions can
be provided.

Right now the only client is ObjC properties, but
this should be generalizable to similar language
features, e.g. Managed C++'s __property methods.

llvm-svn: 142914
2011-10-25 07:27:56 +00:00
Ted Kremenek 7b2fbc61de Relax restriction of assigning to 'self' in ARC when a method is attributed with ns_consumes_self. Fixes <rdar://problem/10274056>.
llvm-svn: 142909
2011-10-25 04:52:20 +00:00
Fariborz Jahanian e96f9c816b Fixes a minor hick up to my last patch.
llvm-svn: 142711
2011-10-22 01:56:45 +00:00
Fariborz Jahanian 512a4cc967 objc: private methods can have their attributes, no diagnostic is required.
None private methods if their implementation have attribute, they must exactly 
match those in their declarations. // rdar://10271563

llvm-svn: 142709
2011-10-22 01:21:15 +00:00
Fariborz Jahanian 2512747959 objective-c: Diagnose redeclaration of private
ivars in class extensions. // rdar://10309454

llvm-svn: 142664
2011-10-21 18:03:52 +00:00
Fariborz Jahanian 7f73302b4f objc: allow class name qualified with protocols in
iboutletcollection attribute. But ignore protocol
list. // rdar://10296078

llvm-svn: 142459
2011-10-18 23:13:50 +00:00
John McCall 91aee685d8 Add a __has_feature check for arc_cf_code_audited.
llvm-svn: 142423
2011-10-18 21:18:53 +00:00
Fariborz Jahanian 2f31b33f34 objc: more changes in use of IBOutletCollection attribute.
'Class' is disallowed as argument.  If the argument is missing, 
NSObject is assumed. // rdar://10296078

llvm-svn: 142409
2011-10-18 19:54:31 +00:00
Fariborz Jahanian 6b70865ec0 objc: diagnose invalid argument to an
iboutletcollection attribute intead of crashing.
// rdar://10296078

llvm-svn: 142364
2011-10-18 17:11:10 +00:00
John McCall 95ff270ee9 Fix several bugs with #pragma clang arc_cf_code_audited and macros.
llvm-svn: 142324
2011-10-18 00:44:04 +00:00
John McCall 4124c4924d Teach the ARC compiler to not require __bridge casts when
passing/receiving CF objects at +0 to/from Objective-C methods
or audited C functions.

llvm-svn: 142219
2011-10-17 18:40:02 +00:00
Fariborz Jahanian c27cd1b881 Avoid duplicate unavailbility diagnostics in objc++.
// rdar://10268422

llvm-svn: 142078
2011-10-15 19:18:36 +00:00
Fariborz Jahanian 1cb83e24d4 objc-arc: Improve arc diagnostic when method is not
found in receiver's class. // rdar://9970739

llvm-svn: 141961
2011-10-14 17:34:08 +00:00
Fariborz Jahanian df4f7ca331 objc-arc: 'Class' property is implicitly __unsafe_unretained.
// rdar://10239594

llvm-svn: 141915
2011-10-13 23:45:45 +00:00
Fariborz Jahanian fa643c8f3b objc: note location of the previously declared
property in the diagnostic.

llvm-svn: 141745
2011-10-12 00:00:57 +00:00
Fariborz Jahanian 55b4e5c208 objc: err on a property designated both atomic and
nonatomic. // rdar://10260017

llvm-svn: 141580
2011-10-10 21:53:24 +00:00
Fariborz Jahanian 9059124b41 objc: Do not warn about mismatch on Super's readonly property attribute,
related to a readwrite property, and
Sub's readwrite property. // rdar://9396329

llvm-svn: 141497
2011-10-08 17:45:33 +00:00
Fariborz Jahanian 9cd57a7061 objc: Improve on diagnostic when atomic proeprty is synthesized
on one accessor and user-provide with another.

llvm-svn: 141343
2011-10-06 23:47:58 +00:00
Argyrios Kyrtzidis c281c96675 Implicitly assume that a ObjC category to an unavailable interface is also unavailable;
only give an 'unavailable' error on the @implementation of the category. rdar://10234078

llvm-svn: 141335
2011-10-06 23:23:27 +00:00
Argyrios Kyrtzidis 9321ad3f97 When using an unavailable/deprecated interface Foo inside Foo's interface/implementation
don't emit unavailable errors.

llvm-svn: 141334
2011-10-06 23:23:20 +00:00
Argyrios Kyrtzidis a7324ede34 Fix crash when using archaic protocol, rdar://10238337
llvm-svn: 141215
2011-10-05 21:28:06 +00:00
Fariborz Jahanian f2a7b0eade objc: Turn diagnostic on property type mismatch in
continuation class into warning. // rdar://10231514

llvm-svn: 141100
2011-10-04 18:44:26 +00:00
Fariborz Jahanian ed1933b02b objc arc: Suppress certain arc diagnostics on unavailable
functions. // rdar://10186536

llvm-svn: 141037
2011-10-03 22:11:57 +00:00
John McCall 9b0a7cea0f Make -fobjc-nonfragile-abi the -cc1 default, since it's the
increasingly prevailing case to the point that new features
like ARC don't even support the fragile ABI anymore.

This required a little bit of reshuffling with exceptions
because a check was assuming that ObjCNonFragileABI was
only being set in ObjC mode, and that's actually a bit
obnoxious to do.

Most, though, it involved a perl script to translate a ton
of test cases.

Mostly no functionality change for driver users, although
there are corner cases with disabling language-specific
exceptions that we should handle more correctly now.

llvm-svn: 140957
2011-10-02 01:16:38 +00:00
John McCall e4fe245716 Allow the results of cf_returns_not_retained function
calls, or calls to audited functions without an explicit
return attribute, to be casted without a bridge cast.
Tie this mechanism in with the existing exceptions to
the cast restrictions.  State those restrictions more
correctly and generalize.

llvm-svn: 140912
2011-10-01 01:01:08 +00:00
John McCall f1e8b34f6c Add an ns_bridged attribute, used to specify that a
pointer to the annotated struct type can be used as an 
Objective-C object pointer.  If an argument is given, the
type is actually "toll-free bridged" to the specific type 
named there, rather than just to 'id'.

For now, we cannot rely on all types being so annotated,
and we'll always have to have exceptions for things like
CFTypeRef (aka const void*), but this is clearly a good
foundation for improving toolage in this area.

llvm-svn: 140779
2011-09-29 07:17:38 +00:00
Ted Kremenek 7fd1723619 Like IBOutletCollection, it only makes sense to apply the IBOutlet annotation to Objective-C object types. Fixes <rdar://problem/10142685>.
llvm-svn: 140778
2011-09-29 07:02:25 +00:00
Fariborz Jahanian 97676979a7 objc arc: Diagnose block pointer type mismatch when
some arguments types are ns_consumed and some otherwise
matching types are not. This is objc side of
// rdar://10187884

llvm-svn: 140729
2011-09-28 21:52:05 +00:00
Ted Kremenek 3f443a71dc Tweak -Wobjc-missing-super-calls to not warning about missing [super dealloc] when in GC-only mode, and to not warning about missing [super finalize] when not using GC.
llvm-svn: 140713
2011-09-28 19:32:29 +00:00
Ted Kremenek ab2dcc8de6 Include prefix with default synthesized ivars.
llvm-svn: 140657
2011-09-27 23:39:40 +00:00
Douglas Gregor 75acd925d0 Only print _Bool as 'bool' when 'bool' is defined as an object-like
macro whose only replacement token is '_Bool'.

llvm-svn: 140656
2011-09-27 23:30:47 +00:00
Douglas Gregor c0b07286cf When 'bool' is not a built-in type but is defined as a macro, print
'bool' rather than '_Bool' within types, to make things a bit more
readable. Fixes <rdar://problem/10063263>.

llvm-svn: 140650
2011-09-27 22:38:19 +00:00
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