Fariborz Jahanian
86c2f5cc70
objective-c: provide fixit hint when atomic property does not
...
have matching user defined setter/getter and a warning is issued.
In this case, a fixit note is displayed. // rdar://10267155
llvm-svn: 151766
2012-02-29 22:18:55 +00:00
Ted Kremenek
59b10db2bc
After numerous requests, have Objective-C 'method declared here' notes mention the actual method. This looks better within an IDE, where text isn't always regurgitated in the presentation of a warning. Fixes radar 10914035.
...
llvm-svn: 151579
2012-02-27 22:55:11 +00:00
Eli Friedman
8a78a58188
Improve the diagnostic in ARC mode when a conditional with an Objective-C type and void* is used. <rdar://problem/10486347>.
...
llvm-svn: 151416
2012-02-25 00:23:44 +00:00
Eli Friedman
ec52f92db3
Handle "#pragma GCC visibility" in a few more places. Switch over "#pragma pack" to use the same handling that gcc does. Fixes <rdar://problem/10871094> and <rdar://problem/10893316>.
...
(Hopefully, common usage of these pragmas isn't irregular enough to break our current handling. Doug has ideas for a more crazy approach if necessary.)
llvm-svn: 151307
2012-02-23 23:47:16 +00:00
Fariborz Jahanian
86f8266b9f
objective-c++: Type of an objc string literal is NSString, not 'id'.
...
// rdar://10907410
llvm-svn: 151296
2012-02-23 22:51:36 +00:00
John McCall
24992371a5
Don't crash on attempts to synthesize an invalid property.
...
rdar://problem/10904479
llvm-svn: 151089
2012-02-21 21:48:05 +00:00
Jean-Daniel Dupas
58dab6829a
When calling a non variadic format function(vprintf, vscanf, NSLogv, …), warn if the format string argument is a parameter that is not itself declared as a format string with compatible format.
...
llvm-svn: 151080
2012-02-21 20:00:53 +00:00
Ted Kremenek
084e1b48a1
Change wording of warning about using __bridge casts in non-ARC.
...
llvm-svn: 150868
2012-02-18 04:42:38 +00:00
Ted Kremenek
6eb25628c5
Revert r145999. This turned out to be a bad idea. Unfortunately, 'id' is used so profusely
...
in many APIs and large codebases that this made the deprecated warning trigger happy to
the point of not being useful.
llvm-svn: 150223
2012-02-10 02:45:47 +00:00
Fariborz Jahanian
29082a5f1d
objc: If a method is not implemented in the category implementation but
...
has been declared in its primary class, superclass,
or in one of their protocols, no need to issue unimplemented method.
// rdar://10823023
llvm-svn: 150206
2012-02-09 21:30:24 +00:00
John McCall
5ece54ce3f
Only complain about __strong __strong id, not __strong SomeStrongTypedef
...
or __strong __typeof__(some.strong.thing).
llvm-svn: 150029
2012-02-08 00:46:41 +00:00
Argyrios Kyrtzidis
b6c6a58366
Make parsing of objc @implementations more robust.
...
Parsing of @implementations was based on modifying global state from
the parser; the logic for late parsing of methods was spread in multiple places
making it difficult to have a robust error recovery.
-it was difficult to ensure that we don't neglect parsing the lexed methods.
-it was difficult to setup the original objc container context for parsing the lexed methods
after completing ParseObjCAtImplementationDeclaration and returning to top level context.
Enhance parsing of @implementations by centralizing it in Parser::ParseObjCAtImplementationDeclaration().
ParseObjCAtImplementationDeclaration now returns only after an @implementation is fully parsed;
all the data and logic for late parsing of methods is now in one place.
This allows us to provide code-completion for late parsed methods with mis-matched braces.
rdar://10775381
llvm-svn: 149987
2012-02-07 16:50:53 +00:00
Eli Friedman
2beed114ba
Fix a couple of nasty bugs involving negative enum constants. <rdar://problem/10760113>.
...
llvm-svn: 149965
2012-02-07 04:34:38 +00:00
Ted Kremenek
d22b98aad2
Tweak format string checking to work with %@ and ObjC toll-free bridging. <rdar://problem/10814120>
...
llvm-svn: 149907
2012-02-06 21:45:29 +00:00
Fariborz Jahanian
adfe905145
objc: fixes a problem in block type comparison involving
...
enums with underlying type explicitly specified
(feature which is on by default in objective-c).
// rdar://10798770
llvm-svn: 149888
2012-02-06 19:06:20 +00:00
Sean Callanan
8870a32408
Fixed some testsuite problems introduced by my
...
last commit. Sorry for the outage.
llvm-svn: 149744
2012-02-04 02:28:18 +00:00
Nico Weber
d1928cb912
Revert r149721. chapuni tells me akyrtzi already fixed the test
...
by adding a triple, and the typedef makes things worse on windows.
llvm-svn: 149740
2012-02-04 01:50:30 +00:00
Sean Callanan
1ce3a6b650
Clang has existing support for debuggers that
...
want to provide "po"-like functionality which
treats the result of an expression implicitly as
"id" (if it is not otherwise known) and prints
it as an Objective-C object.
This has in the past been gated by the
"DebuggerSupport" language option, but that is
too general. Debuggers also provide other commands
like "print" that do not make any assumptions
about whether the object is an Objective-C object.
This patch makes the assumption conditional on a
new language option: DebuggerCastResultToId. I
have also made corresponding modifications to the
testsuite.
llvm-svn: 149735
2012-02-04 01:29:37 +00:00
Nico Weber
bf5e6442e7
Try to get test passing on windows.
...
Idea by Jean-Daniel Dupas.
llvm-svn: 149721
2012-02-03 23:36:13 +00:00
Argyrios Kyrtzidis
e340deedbf
Add a triple to test/SemaObjC/format-strings-objc.m to make it pass in windows hosts.
...
llvm-svn: 149696
2012-02-03 17:13:43 +00:00
Ted Kremenek
60bbeb345b
Further downgrade -Warc-bridge-casts-disallowed-in-nonarc to a warning (not mapped to an error). We can consider mapping it back to an error later.
...
llvm-svn: 149670
2012-02-03 05:01:51 +00:00
Ted Kremenek
172039a89c
Make error about using bridge casts in non-ARC mode a warning that is default mapped to an error. This is to ease the transition of large apps moving from non-ARC to ARC.
...
llvm-svn: 149659
2012-02-03 01:30:34 +00:00
Fariborz Jahanian
c934de67e0
objc: Issue diagnostic when receiver type is a forward class declaration and
...
it is treated as of 'id' type resulting in multiple method lookup.
// rdar://10686120
llvm-svn: 149653
2012-02-03 01:02:44 +00:00
Fariborz Jahanian
6a73384b53
objective-c: When redeclaraing in continuation class a 'readonly'
...
property to 'readwrite', also allow redeclaration of
property type to a narrowring object type.
// rdar://10790488
llvm-svn: 149614
2012-02-02 18:54:58 +00:00
Fariborz Jahanian
17612b1dbf
objc: don't crash if primary class is missing and continuation class
...
is declaring ivars. // rdar://10752081
llvm-svn: 149573
2012-02-02 00:49:12 +00:00
Fariborz Jahanian
ccded6e447
objc2: add __has_feature(objc_default_synthesize_properties).
...
// rdar://10770497
llvm-svn: 149565
2012-02-02 00:15:51 +00:00
Fariborz Jahanian
30febeb224
Look for declaration of CFBridgingRetain/CFBridgingRetain before
...
changing the diagnostic. Also use correct spelling for both.
llvm-svn: 149554
2012-02-01 22:56:20 +00:00
Fariborz Jahanian
bcdc282d85
objc-arc: In various diagnostics mention
...
CFBridgingRetain/CFBridgingRelease calls instead
of __bridge_retained/__bridge_transfer casts as preferred
way of moving cf objects to arc land. // rdar://10207950
llvm-svn: 149449
2012-01-31 23:42:37 +00:00
Nico Weber
496cdc2cb7
Let %S, %ls, %C match 16bit types in NSStrings.
...
As discussed at http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120130/052200.html
llvm-svn: 149325
2012-01-31 01:43:25 +00:00
Jean-Daniel Dupas
537aa1ac68
Disable "non literal format string" for NSString that result from a macro expansion.
...
This is to prevent diagnostic when using NSLocalizedString or CFCopyLocalizedString
macros which are usually used in place of NS and CF strings literals.
llvm-svn: 149268
2012-01-30 19:46:17 +00:00
Jean-Daniel Dupas
028573e794
Update on format attribute handling.
...
- Remove the printf0 special handling as we treat it as printf anyway.
- Perform basic checks (non-literal, empty) for all formats and not only printf/scanf.
llvm-svn: 149236
2012-01-30 08:46:47 +00:00
Jean-Daniel Dupas
400dd1c3d0
Remove the "C" in "implicitly declaring C library function" diagnostic
...
because all functions are not C functions (i.e. NSLog).
llvm-svn: 149150
2012-01-27 23:21:02 +00:00
John McCall
18a962bab5
Don't suppress access-control or invalid-type diagnostics from a
...
declarator just because we were able to build an invalid decl
for it. The invalid-type diagnostics, in particular, are still useful
to know, and may indicate something about why the decl is invalid.
Also, recover from an illegal pointer/reference-to-unqualified-retainable
type using __strong instead of __autoreleasing; in general, a random
object is much more likely to be __strong, so this avoids unnecessary
cascading errors in the most common case.
llvm-svn: 149074
2012-01-26 20:04:03 +00:00
Fariborz Jahanian
194904e499
objc: 'id' and block pointer compare in mergeTypes is
...
made symmetrical. // rdar://10734265
llvm-svn: 149065
2012-01-26 17:08:50 +00:00
Fariborz Jahanian
26d8371b07
objc: allow block pointer matching 'id' type when
...
they show up as argument types of two block pointers.
// rdar://10734265
llvm-svn: 149007
2012-01-26 00:45:38 +00:00
Jean-Daniel Dupas
d5f7ef48e2
Add support for const pointer to literal-objc string as format attribute.
...
llvm-svn: 148948
2012-01-25 10:35:33 +00:00
Jean-Daniel Dupas
9aa95b16e1
Fix test on cygwin (where va_list expands to a different type)
...
llvm-svn: 148892
2012-01-25 01:02:26 +00:00
Ted Kremenek
9b1f3d46d0
Fix NSLog format string checking for %@.
...
llvm-svn: 148885
2012-01-25 00:04:09 +00:00
Jean-Daniel Dupas
78536ae5b5
Replace a hack to handle NSLog/NSLogv in sema by declaring them as Library Builtins.
...
llvm-svn: 148873
2012-01-24 22:32:46 +00:00
Jean-Daniel Dupas
5778cb8e06
Remove trailing slash in front of header name of ObjC builtins.
...
llvm-svn: 148872
2012-01-24 22:29:27 +00:00
Fariborz Jahanian
e2a7776eff
objc: Issue a generic diagnostic assigning to
...
an objc object in any abi mode.
llvm-svn: 148847
2012-01-24 19:40:13 +00:00
Fariborz Jahanian
04c4455dd4
objective-c: Ignore with warning forward class declaration whose name
...
matches a typedef declaring an object type. // rdar://10733000
llvm-svn: 148760
2012-01-24 00:40:15 +00:00
Ted Kremenek
e7b9d4342b
Tighten format string diagnostic and make it a bit clearer (and a bit closer to GCC's).
...
llvm-svn: 148579
2012-01-20 21:52:58 +00:00
Fariborz Jahanian
28324b0066
objc: deprecate direct usage of 'isa' of objc objects
...
in favor of usage of api's intended for.
// rdar://8290002
llvm-svn: 148404
2012-01-18 19:08:56 +00:00
Fariborz Jahanian
c72a807039
objc-arc: when 'assign' attribute is unspecified,
...
rely on property's type for its life-time to avoid
bogus warning with -Warc-unsafe-retained-assign.
// rdar://10694932
llvm-svn: 148355
2012-01-17 22:58:16 +00:00
Bob Wilson
206e2302eb
Disable -Wduplicate-method-match by default. <rdar://problem/10663536>
...
llvm-svn: 148343
2012-01-17 22:24:32 +00:00
Jean-Daniel Dupas
0ae6e671cc
Fix a couples of issues in format strings checking.
...
PR 10274: format function attribute with the NSString archetype yields no compiler warnings
PR 10275: format function attribute isn't checked in Objective-C methods
llvm-svn: 148324
2012-01-17 20:03:31 +00:00
Fariborz Jahanian
9d7cf2baaf
objc: fixes a bug where struct used inside an
...
objc class was not being exported to parent decl
context resulting in bogus mismatch warning later on.
// rdar://10655530
llvm-svn: 148320
2012-01-17 18:52:07 +00:00
Fariborz Jahanian
52d02f68e5
objc: disallow __block attribute on method params.
...
llvm-svn: 148197
2012-01-14 18:44:35 +00:00
Fariborz Jahanian
372030b2a1
objc parsing. Fixes a crash when parsing array initialization
...
inside a class implementation with parse errors. // rdar://10633434
llvm-svn: 148074
2012-01-13 00:14:12 +00:00
Fariborz Jahanian
e74d47ed03
objc: do not warn when converting to a const id qualfied by its
...
list of protools. // rdar://10669694
llvm-svn: 148051
2012-01-12 22:12:08 +00:00
Fariborz Jahanian
4f8cb1e83a
objective-c: fixes a regression in looking up names
...
in class extensions and categories by recent refactoring
of objc class ASTs. // rdar://1066654
llvm-svn: 147982
2012-01-12 00:18:35 +00:00
Fariborz Jahanian
39ba639f9d
objc-arc: evaluate 'readonly' property with no known
...
life-time to that of its backing 'ivar's lifetime.
// rdar://10558871
llvm-svn: 147956
2012-01-11 18:26:06 +00:00
John McCall
9b80c2186f
Do placeholder conversions on array bounds in both declarators and
...
new-expressions.
llvm-svn: 147900
2012-01-11 00:14:46 +00:00
Fariborz Jahanian
edbc345170
objc-arc: fixes a crash when trying to find out retaining cycle
...
ownership of property sent to 'super'. // rdar://10640891
llvm-svn: 147868
2012-01-10 19:28:26 +00:00
Ted Kremenek
0c2c90b1ad
After further discussion, rename attribute 'objc_disable_automatic_synthesis' to 'objc_requires_property_definitions'.
...
llvm-svn: 147622
2012-01-05 22:47:47 +00:00
Ted Kremenek
dec9d12fc4
Rename attribute 'objc_suppress_autosynthesis' to 'objc_disable_automatic_synthesis'.
...
llvm-svn: 147567
2012-01-04 23:51:09 +00:00
Fariborz Jahanian
f716839580
Test case for my previous patch.
...
llvm-svn: 147563
2012-01-04 23:16:48 +00:00
Fariborz Jahanian
a28a78ec2f
Support __has_attribute for objc_suppress_autosynthesis
...
which is automatic with proper spelling :).
llvm-svn: 147555
2012-01-04 22:29:28 +00:00
Fariborz Jahanian
1fc1c6c307
In non-gc, non-arc mode, property of 'Class' type
...
variety is treated as a 'void *'. No need to issue
warning reserved for objc object properties.
// rdar://10565506
llvm-svn: 147504
2012-01-04 00:31:53 +00:00
Fariborz Jahanian
7249e36704
objc: diagnose misplacement of objc_suppress_autosynthesis
...
attribute.
llvm-svn: 147490
2012-01-03 22:52:32 +00:00
Fariborz Jahanian
3c9707bd90
objc: use objc_suppress_autosynthesis attribute on classes
...
which should not be default synthesized.
llvm-svn: 147468
2012-01-03 19:46:00 +00:00
Fariborz Jahanian
028b9e1d0a
objc/c++: Issue diagnostic when free-standing ivar is accessed
...
in class method instead of crash. // rdar://10593227
llvm-svn: 146998
2011-12-20 22:21:08 +00:00
Ted Kremenek
dd5d0dc4f4
Refine error diagnostic for using bridged casts when not using ARC.
...
llvm-svn: 146938
2011-12-20 01:03:40 +00:00
Fariborz Jahanian
f9aca2089e
objc-arc: bridge casts in non-arc mode are now
...
error. // rdar://10597832
llvm-svn: 146918
2011-12-19 22:52:53 +00:00
Fariborz Jahanian
103ae5c48f
objc-arc: bridge casts in non-objc-arc mode are ignord.
...
But, warn too. // rdar://10597832
llvm-svn: 146904
2011-12-19 21:06:15 +00:00
Fariborz Jahanian
21c2484454
objc: after issuing the warning on direct use of __attribute__((NSObject))
...
on properties, prevent consequential error diagnostics. // rdar://10591336
llvm-svn: 146737
2011-12-16 15:54:29 +00:00
Douglas Gregor
ab1ec82e04
Fix chaining of ObjCInterfaceDecl redeclarations
...
llvm-svn: 146722
2011-12-16 03:12:41 +00:00
Douglas Gregor
dc9166c8e1
Keep track of all declarations of an Objective-C class (both forward
...
declarations and definitions) as ObjCInterfaceDecls within the same
redeclaration chain. This new representation matches what we do for
C/C++ variables/functions/classes/templates/etc., and makes it
possible to answer the query "where are all of the declarations of
this class?"
llvm-svn: 146679
2011-12-15 20:29:51 +00:00
Fariborz Jahanian
9e49b6a6ff
objc: do not auto synthesize properties declared in
...
protocols; with a warning. // rdar://10567333
llvm-svn: 146626
2011-12-15 01:03:18 +00:00
Douglas Gregor
95715f9ecf
In debugger support mode, if we have a top-level message send
...
expression with an unknown result type, assume that the result type is
'id'. Fixes <rdar://problem/10400663>.
llvm-svn: 146622
2011-12-15 00:53:32 +00:00
Richard Trieu
553b2b2e5d
Modify how the -verify flag works. Currently, the verification string and
...
diagnostic message are compared. If either is a substring of the other, then
no error is given. This gives rise to an unexpected case:
// expect-error{{candidate function has different number of parameters}}
will match the following error messages from Clang:
candidate function has different number of parameters (expected 1 but has 2)
candidate function has different number of parameters
It will also match these other error messages:
candidate function
function has different number of parameters
number of parameters
This patch will change so that the verification string must be a substring of
the diagnostic message before accepting. Also, all the failing tests from this
change have been corrected. Some stats from this cleanup:
87 - removed extra spaces around verification strings
70 - wording updates to diagnostics
40 - extra leading or trailing characters (typos, unmatched parens or quotes)
35 - diagnostic level was included (error:, warning:, or note:)
18 - flag name put in the warning (-Wprotocol)
llvm-svn: 146619
2011-12-15 00:38:15 +00:00
Fariborz Jahanian
c17c86b56c
objc: diagnose duplicate declaration of methods
...
in classes. // rdar://10535349
llvm-svn: 146504
2011-12-13 19:40:34 +00:00
Fariborz Jahanian
b989e6e50a
objc-arc: better diagnostic when block is declared
...
inside a struct/union.
llvm-svn: 146444
2011-12-12 23:17:04 +00:00
Fariborz Jahanian
e283346d0b
objc-arc: diagnose synthesis of a 'weak unavailable' property.
...
// rdar://10535245
llvm-svn: 146272
2011-12-09 19:55:11 +00:00
Fariborz Jahanian
6bdeb14d5d
objc: issue deprecated/unavailable diagnostic when
...
methods with these attributes are sent to receivers
of 'id' type too. // rdar://10459930
llvm-svn: 145999
2011-12-07 00:30:00 +00:00
Erik Verbruggen
c6c8d9356d
Extend warnings for missing '@end'.
...
Fixes PR2709.
llvm-svn: 145928
2011-12-06 09:25:23 +00:00
Fariborz Jahanian
56f326e7f2
objc: put out more coherent warning when method definition
...
attributes don't match its declaration. // rdar://10529259.
llvm-svn: 145872
2011-12-06 00:02:41 +00:00
Douglas Gregor
11bb308457
When typo-correction an Objective-C superclass name, don't
...
typo-correct to ourselves.
llvm-svn: 145583
2011-12-01 15:37:53 +00:00
Douglas Gregor
d8fb1e30eb
When sending a message to a receiver that has "unknown any" type,
...
force the unknown any type to "id" so that the message send can be
completed without requiring a case. Fixes <rdar://problem/10506646>.
llvm-svn: 145552
2011-12-01 01:37:36 +00:00
Ted Kremenek
764d63ad94
Specially whitelist the selector 'addOperationWithBlock:' for the retain-cycle checking in -Warc-retain-cycles. This commonly
...
is hit by users using NSOperationQueue. Fixes <rdar://problem/10465721>.
llvm-svn: 145548
2011-12-01 00:59:21 +00:00
Fariborz Jahanian
a45495a9f2
objc: warn if NSObject attribute appears other than in a typedef.
...
// rdar://10453342
llvm-svn: 145358
2011-11-29 01:48:40 +00:00
Fariborz Jahanian
22b405c7aa
objc: turn warning for property type mismatch in
...
primary and its continuation class into error.
// rdar://10142679
llvm-svn: 145255
2011-11-28 18:38:27 +00:00
Douglas Gregor
4123a86fae
Use Sema::RequireCompleteType to check for the completeness of
...
Objective-C classes. This has two purposes: to consistently provide
"forward declaration here" notes when we hit an incomplete type, and
to give LLDB a chance to complete the type.
RequireCompleteType bits from Sean Callanan!
llvm-svn: 144573
2011-11-14 22:10:01 +00:00
Argyrios Kyrtzidis
95dfc12cd6
Don't crash when a duplicate interface/protocol is inside an extern "C" context.
...
llvm-svn: 144508
2011-11-13 22:08:30 +00:00
Argyrios Kyrtzidis
3a8de5b560
Don't crash on invalid objc code.
...
llvm-svn: 144150
2011-11-09 00:22:48 +00:00
Fariborz Jahanian
557fc9a99d
objc: Don't crash on missing @interface decl.
...
// rdar://10415026
llvm-svn: 144143
2011-11-08 22:51:27 +00:00
Fariborz Jahanian
b1ac0813a6
objc-arc: 'readonly' property of retainable object
...
type is strong by default too. // rdar://10410903
llvm-svn: 144118
2011-11-08 20:58:53 +00:00
John McCall
cfef546d40
There are some crazy cases that LookupMethodInReceiverType
...
doesn't duplicate, but they all surface as implicit
properties. It's also a useful optimization to not
duplicate the implicit getter lookup. So, trust the
getter lookup that was already done in these cases.
llvm-svn: 144031
2011-11-07 22:49:50 +00:00
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
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