summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Move the definition-specific data of ObjCInterfaceDecl into aDouglas Gregor2011-12-151-5/+6
| | | | | | | | | | | | | | | | separately-allocated DefinitionData structure, which we manage the same way as CXXRecordDecl::DefinitionData. This prepares the way for making ObjCInterfaceDecls redeclarable, to more accurately model forward declarations of Objective-C classes and eliminate the mutation of ObjCInterfaceDecl that causes us serious trouble in the AST reader. Note that ObjCInterfaceDecl's accessors are fairly robust against being applied to forward declarations, because Clang (and Sema in particular) doesn't perform RequireCompleteType/hasDefinition() checks everywhere it has to. Each of these overly-robust cases is marked with a FIXME, which we can tackle over time. llvm-svn: 146644
* objc: issue deprecated/unavailable diagnostic whenFariborz Jahanian2011-12-071-0/+3
| | | | | | | methods with these attributes are sent to receivers of 'id' type too. // rdar://10459930 llvm-svn: 145999
* When sending a message to a receiver that has "unknown any" type,Douglas Gregor2011-12-011-3/+7
| | | | | | | 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
* Use Sema::RequireCompleteType to check for the completeness ofDouglas Gregor2011-11-141-30/+32
| | | | | | | | | | 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
* Don't crash on invalid objc code.Argyrios Kyrtzidis2011-11-091-0/+5
| | | | llvm-svn: 144150
* Rip out CK_GetObjCProperty.John McCall2011-11-071-1/+0
| | | | llvm-svn: 143910
* Change the AST representation of operations on Objective-CJohn McCall2011-11-061-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | property references to use a new PseudoObjectExpr expression which pairs a syntactic form of the expression with a set of semantic expressions implementing it. This should significantly reduce the complexity required elsewhere in the compiler to deal with these kinds of expressions (e.g. IR generation's special l-value kind, the static analyzer's Message abstraction), at the lower cost of specifically dealing with the odd AST structure of these expressions. It should also greatly simplify efforts to implement similar language features in the future, most notably Managed C++'s properties and indexed properties. Most of the effort here is in dealing with the various clients of the AST. I've gone ahead and simplified the ObjC rewriter's use of properties; other clients, like IR-gen and the static analyzer, have all the old complexity *and* all the new complexity, at least temporarily. Many thanks to Ted for writing and advising on the necessary changes to the static analyzer. I've xfailed a small diagnostics regression in the static analyzer at Ted's request. llvm-svn: 143867
* objc-arc: desugar certain type and improve on diagnostic forFariborz Jahanian2011-10-291-10/+20
| | | | | | | ownership qualifier cast which won't work. // rdar://10244607 llvm-svn: 143258
* objective-c arc: type-casting of an objc pointer toFariborz Jahanian2011-10-281-1/+18
| | | | | | | an rvalue retainable object type with life-time qualifier has no effect and wil be diagnosed as error. // rdar://10244607 llvm-svn: 143219
* Restore r142914 and r142915, now with missing file and apparentJohn McCall2011-10-251-53/+43
| | | | | | GCC compiler workaround. llvm-svn: 142931
* Revert r142914 and r142915, due to possibly missing file.NAKAMURA Takumi2011-10-251-43/+53
| | | | | | r142914: "Introduce a placeholder type for "pseudo object"" r142915: "Pull the pseudo-object stuff into its own file." llvm-svn: 142921
* Introduce a placeholder type for "pseudo object"John McCall2011-10-251-53/+43
| | | | | | | | | | | | | | | 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
* Strip qualifiers off the type of an implicit property defined byJohn McCall2011-10-171-1/+1
| | | | | | only a setter. llvm-svn: 142236
* Teach the ARC compiler to not require __bridge casts whenJohn McCall2011-10-171-74/+189
| | | | | | | passing/receiving CF objects at +0 to/from Objective-C methods or audited C functions. llvm-svn: 142219
* Avoid duplicate unavailbility diagnostics in objc++.Fariborz Jahanian2011-10-151-1/+3
| | | | | | // rdar://10268422 llvm-svn: 142078
* ArrayRef'ize ObjCMessageExprArgyrios Kyrtzidis2011-10-031-6/+10
| | | | llvm-svn: 140986
* Pass all the locations of the selector identifiers for a message expression ↵Argyrios Kyrtzidis2011-10-031-20/+22
| | | | | | | | from the parser. They are not kept in the AST yet. llvm-svn: 140982
* Allow the results of cf_returns_not_retained functionJohn McCall2011-10-011-133/+281
| | | | | | | | | | 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
* Revert r139989 and r140031, which implemented the Objective-C typeDouglas Gregor2011-09-271-9/+7
| | | | | | | | | 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
* objc - Treat type of 'self' in class methods as root ofFariborz Jahanian2011-09-171-7/+9
| | | | | | class of this method. // rdar://10109725 llvm-svn: 139989
* Rename the ARC cast kinds to start with "ARC".John McCall2011-09-101-3/+3
| | | | llvm-svn: 139466
* Don't produce 'instancetype' as the type of a message send expression. Map ↵Douglas Gregor2011-09-091-2/+9
| | | | | | it down to 'id'. llvm-svn: 139394
* Contextually converting to 'id' is not a useful operation. ContextuallyJohn McCall2011-09-091-7/+2
| | | | | | | | | | | | converting to an arbitrary Objective-C pointer type is. Without significantly re-implementing anything, change the API to reflect this, and as a minor optimization, strip the pointer conversion off before potentially building it. Mostly, this removes a really bizarre-looking bit of code from BuildInstanceMessage. llvm-svn: 139354
* Give conversions of block pointers to ObjC pointers a different cast kindJohn McCall2011-09-091-3/+10
| | | | | | | | than conversions of C pointers to ObjC pointers. In order to ensure that we've caught every case, add asserts to CastExpr that strictly determine which cast kind is used for which kind of bit cast. llvm-svn: 139352
* Implement the Objective-C 'instancetype' type, which is an alias ofDouglas Gregor2011-09-081-0/+4
| | | | | | | | | | '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
* Don't assert when diagnosing a missing cast of an unknown-anytypeJohn McCall2011-08-311-2/+3
| | | | | | | | message send to an unknown method. rdar://problem/9416370, redux. llvm-svn: 138893
* Warn on missing [super finalize] calls.Nico Weber2011-08-281-0/+4
| | | | | | This matches gcc's logic. Second half of PR10661. llvm-svn: 138730
* Be sure to do unary conversions on the operand to an ARCJohn McCall2011-08-261-0/+4
| | | | | | bridged cast. Noticed by AST inspection by Ted Kremenek! llvm-svn: 138616
* Warn on missing [super dealloc] calls.Nico Weber2011-08-221-0/+3
| | | | | | This matches gcc's logic. Half of PR10661. llvm-svn: 138240
* Add support for C++0x unicode string and character literals, from Craig Topper!Douglas Gregor2011-07-271-3/+3
| | | | llvm-svn: 136210
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-1/+1
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* With -Wselector, don't warn about unimplemented optional methodFariborz Jahanian2011-07-131-5/+8
| | | | | | | used in @selector expression because, well, their implementation is optional. // rdar://9545564 llvm-svn: 135057
* In debugger mode, make ObjC message sends to unknown selectors returnJohn McCall2011-07-131-1/+8
| | | | | | | | | | __unknown_anytype, and rewrite such message sends correctly. I had to bite the bullet and actually add a debugger support mode for this one, which is a bit unfortunate, but there really isn't anything else I could imagine doing; this is clearly just debugger-specific behavior. llvm-svn: 135051
* objc++-arc: diagnose assignment/cast of a weak-unavailableFariborz Jahanian2011-07-071-0/+17
| | | | | | | object to a __weak object/type. // rdar://9732636. One item is yet todo. llvm-svn: 134655
* In ARC, reclaim all return values of retainable type, not just thoseJohn McCall2011-07-071-0/+17
| | | | | | | | | | | | where we have an immediate need of a retained value. As an exception, don't do this when the call is made as the immediate operand of a __bridge retain. This is more in the way of a workaround than an actual guarantee, so it's acceptable to be brittle here. rdar://problem/9504800 llvm-svn: 134605
* objc-arc: enforce performSelector rules in rejecting retaining selectorsFariborz Jahanian2011-07-051-0/+48
| | | | | | | passed to it, and unknown selectors causing potential leak. // rdar://9659270 llvm-svn: 134449
* Add support for C++ namespace-aware typo correction, e.g., correctingDouglas Gregor2011-06-281-13/+15
| | | | | | | | | | | | | | | vector<int> to std::vector<int> Patch by Kaelyn Uhrain, with minor tweaks + PCH support from me. Fixes PR5776/<rdar://problem/8652971>. Thanks Kaelyn! llvm-svn: 134007
* Provide fix-it for '.' <-> '->' for Objective-C ivar/property access.Fariborz Jahanian2011-06-281-3/+12
| | | | | | // rdar://7811841 llvm-svn: 133970
* objc-arc: Allow unbridged cast of retainable object toFariborz Jahanian2011-06-221-1/+1
| | | | | | | integral as it is not transferring ownership.. // rdar://9619861 llvm-svn: 133622
* objc-arc: Add support for unbridged cast of Fariborz Jahanian2011-06-211-19/+39
| | | | | | | | __builtin___CFStringMakeConstantString and CF typed function calls with explicit cf_returns_retained/cf_returns_not_retained attributes. // rdar://9544832 llvm-svn: 133535
* objc-arc: CodeGen part of unbridged cast of CF types.Fariborz Jahanian2011-06-211-5/+41
| | | | | | // rdar://9474349 llvm-svn: 133525
* Make more use of llvm::StringRef in various APIs. In particular, don'tJay Foad2011-06-211-1/+1
| | | | | | use the deprecated forms of llvm::StringMap::GetOrCreateValue(). llvm-svn: 133515
* objc-arc: allow explicit unbridged casts if the source of the cast is aFariborz Jahanian2011-06-201-0/+10
| | | | | | | message sent to an objc method (or property access) // rdar://9474349 llvm-svn: 133469
* Initialize a couple of variables to shut GCC up.John McCall2011-06-171-1/+1
| | | | llvm-svn: 133246
* For the purpose of @encode'ing, accept 'void' typeFariborz Jahanian2011-06-161-1/+2
| | | | | | | (even though it is incomplete type) because gcc says so. // rdar://9622422 llvm-svn: 133208
* Automatic Reference Counting.John McCall2011-06-151-11/+398
| | | | | | | | | | Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. llvm-svn: 133103
* Implement Objective-C Related Result Type semantics.Douglas Gregor2011-06-111-13/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Related result types apply Cocoa conventions to the type of message sends and property accesses to Objective-C methods that are known to always return objects whose type is the same as the type of the receiving class (or a subclass thereof), such as +alloc and -init. This tightens up static type safety for Objective-C, so that we now diagnose mistakes like this: t.m:4:10: warning: incompatible pointer types initializing 'NSSet *' with an expression of type 'NSArray *' [-Wincompatible-pointer-types] NSSet *array = [[NSArray alloc] init]; ^ ~~~~~~~~~~~~~~~~~~~~~~ /System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:72:1: note: instance method 'init' is assumed to return an instance of its receiver type ('NSArray *') - (id)init; ^ It also means that we get decent type inference when writing code in Objective-C++0x: auto array = [[NSMutableArray alloc] initWithObjects:@"one", @"two",nil]; // ^ now infers NSMutableArray* rather than id llvm-svn: 132868
* Emit an error when trying to @encode an incomplete type.Argyrios Kyrtzidis2011-05-141-1/+7
| | | | | | | | There are APIs, e.g. [NSValue valueWithBytes:objCType:], which use the encoding to find out the size of an object pointed to by a pointer. Make things safer by making it illegal to @encode incomplete types. llvm-svn: 131364
* "note" location of forward class used as receiver ofFariborz Jahanian2011-04-231-2/+3
| | | | | | | a 'deprecated' selector in the diagnostics for the selector. // rdar://9309223 llvm-svn: 130062
* Fix a crash-on-invalid involving non-identifier names in a memberDouglas Gregor2011-04-201-0/+7
| | | | | | | access expression that appears to be a property reference. Fixes <rdar://problem/8985943>. llvm-svn: 129865
OpenPOWER on IntegriCloud