summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Enforce nonnull __attribute__ on Objective-C method calls.Fariborz Jahanian2011-04-151-0/+6
| | | | | | // rdar://9287695 llvm-svn: 129615
* Add a flag to StringLiteral to keep track of whether the string is a pascal ↵Anders Carlsson2011-04-141-1/+2
| | | | | | string or not. llvm-svn: 129488
* Use ExprResult& instead of Expr *& in SemaJohn Wiegley2011-04-081-26/+39
| | | | | | | | | | | | | | | | | | | | | | | | | This patch authored by Eric Niebler. Many methods on the Sema class (e.g. ConvertPropertyForRValue) take Expr pointers as in/out parameters (Expr *&). This is especially true for the routines that apply implicit conversions to nodes in-place. This design is workable only as long as those conversions cannot fail. If they are allowed to fail, they need a way to report their failures. The typical way of doing this in clang is to use an ExprResult, which has an extra bit to signal a valid/invalid state. Returning ExprResult is de riguour elsewhere in the Sema interface. We suggest changing the Expr *& parameters in the Sema interface to ExprResult &. This increases interface consistency and maintainability. This interface change is important for work supporting MS-style C++ properties. For reasons explained here <http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-February/013180.html>, seemingly trivial operations like rvalue/lvalue conversions that formerly could not fail now can. (The reason is that given the semantics of the feature, getter/setter method lookup cannot happen until the point of use, at which point it may be found that the method does not exist, or it may have the wrong type, or overload resolution may fail, or it may be inaccessible.) llvm-svn: 129143
* Fix lookup for class messages sent to qualified-classFariborz Jahanian2011-04-061-30/+44
| | | | | | | types such that protocols are seached first. Fixes // rdar://9224670 llvm-svn: 129016
* Implements property of reference types. AddingFariborz Jahanian2011-03-281-0/+1
| | | | | | | an executable test to llvm test suite. // rdar://9070460. llvm-svn: 128435
* Also 'self' in blocks need be handled specially.Fariborz Jahanian2011-03-281-1/+4
| | | | | | // rdar://9181463 llvm-svn: 128410
* 'self' is objective-c's 'self' objc pointer only inFariborz Jahanian2011-03-271-0/+3
| | | | | | an objc method. Fixes // rdar://9181463 llvm-svn: 128389
* Property setter/getter must be looked up in property type'sFariborz Jahanian2011-03-091-17/+16
| | | | | | list of protocols as well. // rdar://9078584 llvm-svn: 127367
* Lookup selector in protocol list of qualified objc typeFariborz Jahanian2011-03-091-0/+17
| | | | | | to avoid a bogus warning. // rdar:// 9072298 llvm-svn: 127355
* Warn on usage of unavailable objc 'class' inFariborz Jahanian2011-03-081-1/+1
| | | | | | varienty of cases. // rdar://9092208 llvm-svn: 127257
* Improve diagnostics on missing property decl.Fariborz Jahanian2011-02-171-1/+1
| | | | llvm-svn: 125752
* Improve diagnostics when property names an object type ofFariborz Jahanian2011-02-171-0/+16
| | | | | | a forward class. // rdar://8851803 llvm-svn: 125699
OpenPOWER on IntegriCloud