summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaObjCXX
Commit message (Collapse)AuthorAgeFilesLines
...
* Allow comparison between block pointers and NULL pointerDouglas Gregor2011-06-161-1/+4
| | | | | | constants. Fixes PR10145. llvm-svn: 133179
* Automatic Reference Counting.John McCall2011-06-1514-0/+980
| | | | | | | | | | 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
* Eliminate the -f[no]objc-infer-related-result-type flags; there's noDouglas Gregor2011-06-131-1/+1
| | | | | | reason to allow the user to control these semantics through a flag. llvm-svn: 132919
* Extra test for related result type inferenceDouglas Gregor2011-06-111-0/+1
| | | | llvm-svn: 132874
* Fix order of operands for the warning about incompatible Objective-CDouglas Gregor2011-06-112-3/+3
| | | | | | | pointer assignment in C++. This was a longstanding problem spotted by Jordy Rose. llvm-svn: 132873
* Implement Objective-C Related Result Type semantics.Douglas Gregor2011-06-111-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Allow block returns in C++ with the formDouglas Gregor2011-06-051-0/+26
| | | | | | | | | return <expression> ; in blocks with a 'void' result type, so long as <expression> has type 'void'. This follows the rules for C++ functions. llvm-svn: 132658
* Implement comparisons between nullptr and Objective-C objectDouglas Gregor2011-06-011-0/+13
| | | | | | pointers. Fixes PR10052. llvm-svn: 132397
* Relax the conversion rules for Objective-C GC qualifiers aDouglas Gregor2011-05-082-2/+24
| | | | | | | | | | | | | | | | | | | | | | bit by allowing __weak and __strong to be added/dropped as part of implicit conversions (qualification conversions in C++). A little history: GCC lets one add/remove/change GC qualifiers just about anywhere, implicitly. Clang did roughly the same before, but we recently normalized the semantics of qualifiers across the board to get a semantics that we could reason about (yay). Unfortunately, this tightened the screws a bit too much for GC qualifiers, where it's common to add/remove these qualifiers at will. Overall, we're still in better shape than we were before: we don't permit directly changing the GC qualifier (e.g., __weak -> __strong), so type safety is improved. More importantly, we're internally consistent in our handling of qualifiers, and the logic that allows adding/removing GC qualifiers (but not adding/removing address spaces!) only touches two obvious places. Fixes <rdar://problem/9402499>. llvm-svn: 131065
* When checking for a prior declaration of the name of a namespace, skipDouglas Gregor2011-05-061-0/+14
| | | | | | | | any names that aren't in the appropriate identifier namespaces. Fixes an embarrassing bug where we give a redefinition error due to an Objective-C category (<rdar://problem/9388207>). llvm-svn: 131036
* Add triple in the hope of unbreaking the bubuildbotDouglas Gregor2011-04-271-1/+1
| | | | llvm-svn: 130280
* When comparing Objective-C pointers during overload resolution toDouglas Gregor2011-04-271-0/+12
| | | | | | | | | | | determine which is a better conversion to "void*", be sure to perform the comparison using the safe-for-id ASTContext::canAssignObjCInterfaces() rather than the asserts-with-id ASTContext::canAssignObjCInterfaces(). Fixes <rdar://problem/9327203>. llvm-svn: 130259
* When computing Objective-C pointer conversions in C++, retainDouglas Gregor2011-04-261-0/+24
| | | | | | | | | | | the qualifiers (e.g., GC qualifiers) on the type we're converting from, rather than just blindly adopting the qualifiers of the type we're converting to or dropping qualifiers altogether. As an added bonus, properly diagnose GC qualifier mismatches to eliminate a crash in the overload resolution failure diagnostics. llvm-svn: 130255
* Diagnose C++ abstract parameters for Objective-C methods.John McCall2011-04-231-0/+5
| | | | llvm-svn: 130045
* Improve test case from prior commit ever so slightlyDouglas Gregor2011-04-201-0/+1
| | | | llvm-svn: 129866
* Fix a crash-on-invalid involving non-identifier names in a memberDouglas Gregor2011-04-201-0/+10
| | | | | | | access expression that appears to be a property reference. Fixes <rdar://problem/8985943>. llvm-svn: 129865
* For the purposes of overload resolution, consider a conversion from anDouglas Gregor2011-04-151-0/+10
| | | | | | | | | Objective-C pointer to void* as a "conversion to void*". This allows us to prefer an Objective-C object pointer conversion to a superclass object pointer over an Objective-C object pointer conversion to cv-void*. Fixes PR9735. llvm-svn: 129603
* Objective-C++: The global namespace is an associated namespace of anDouglas Gregor2011-04-121-0/+19
| | | | | | Objective-C pointer type. Fixes <rdar://problem/9142559>. llvm-svn: 129339
* Warn for any kind of initialization if initializer does notFariborz Jahanian2011-04-081-1/+1
| | | | | | | implement lhs's protocols. // rdar://9091389. llvm-svn: 129142
* de-sugared when accessing property reference type.Fariborz Jahanian2011-03-301-0/+44
| | | | | | Add a test case for synthesize ivar. // rdar://9070460 llvm-svn: 128554
* Implements property of reference types. AddingFariborz Jahanian2011-03-281-2/+2
| | | | | | | an executable test to llvm test suite. // rdar://9070460. llvm-svn: 128435
* Fix an objc++ diagnostic initializing objc pointers.Fariborz Jahanian2011-03-212-3/+3
| | | | | | // rdar:// 9139947 llvm-svn: 128013
* Make sure that we always pop a function's scope *before* we callDouglas Gregor2011-03-161-0/+16
| | | | | | | | | | | ActOnFinishFunctionBody/ActOnBlockStmtExpr. This way, we ensure that we diagnose undefined labels before the jump-scope checker gets run, since the jump-scope checker requires (as its invariant) that all of the GotoStmts be wired up correctly. Fixes PR9495. llvm-svn: 127738
* Add -fcxx-exceptions to all tests that use C++ exceptions.Anders Carlsson2011-02-281-1/+1
| | | | llvm-svn: 126599
* Make clang -cc1 disable Objective-C exceptions by default, and add a ↵Anders Carlsson2011-02-221-1/+1
| | | | | | | | -fobjc-exceptions flag to turn them on. Update all tests accordingly. llvm-svn: 126177
* Pass -fexceptions to all tests that use try/catch/throw.Anders Carlsson2011-02-191-1/+1
| | | | llvm-svn: 126037
* Provide overload diagnostics when explicit casts involving class types fail.John McCall2011-02-141-1/+1
| | | | | | PR8626. llvm-svn: 125506
* Implement objective-c++'s block pointer type matching involvingFariborz Jahanian2011-02-121-1/+15
| | | | | | | types which are contravariance in argument types and covariance in return types. // rdar://8979379. llvm-svn: 125445
* Sema::MaybeBindToTemporary() shouldn't treat any expression returningDouglas Gregor2011-02-081-0/+24
| | | | | | | | | a glvalue as a temporary. Previously, we were enumerating all of the cases that coul return glvalues and might be called with Sema::MaybeBindToTemporary(), but that was gross and we missed the Objective-C property reference case. llvm-svn: 125070
* Implement reasonable conversion ranking for Objective-C pointerDouglas Gregor2011-01-312-7/+94
| | | | | | | | | | | | | | | | | | | | | | | | conversions (<rdar://problem/8592139>) for overload resolution. The conversion ranking mirrors C++'s conversion ranking fairly closely, except that we use a same pseudo-subtyping relationship employed by Objective-C pointer assignment rather than simple checking derived-to-base conversions. This change covers: - Conversions to pointers to a specific object type are better than conversions to 'id', 'Class', qualified 'id', or qualified 'Class' (note: GCC doesn't perform this ranking, but it matches C++'s rules for ranking conversions to void*). - Conversions to qualified 'id' or qualified 'Class' are better than conversions to 'id' or 'Class', respectively. - When two conversion sequences convert to the same type, rank the conversions based on the relationship between the types we're converting from. - When two conversion sequences convert from the same non-id, non-Class type, rank the conversions based on the relationship of the types we're converting to. (note: GCC allows this ranking even when converting from 'id', which is extremeley dangerous). llvm-svn: 124591
* Refactor the dependence computation for DeclRefExpr so that we canDouglas Gregor2011-01-191-0/+10
| | | | | | | reuse it for BlockDeclRefExpr. Do so, fixing the dependence calculate for BlockDeclRefExpr. llvm-svn: 123851
* When building the copy expression for a __block variable, make sureJohn McCall2011-01-191-0/+20
| | | | | | | there's a respectable point of instantiation. Also, make sure we do this operation even when instantiating a dependently-typed variable. llvm-svn: 123818
* Ensure that the result type of an Objective-C class message send isDouglas Gregor2011-01-111-0/+13
| | | | | | | complete. However, if it returns a reference type, don't require the type it refers to to be complete. Fixes <rdar://problem/8807070>. llvm-svn: 123214
* Objective-C pointer conversions to 'id' or qualified 'id' subsumeDouglas Gregor2010-12-061-0/+9
| | | | | | | | cv-qualification conversions. More specifically, there's an implicit cv-qualification conversion (even one that drops qualifiers) when converting to 'id' or qualified 'id'. Fixes <rdar://problem/8734046>. llvm-svn: 121047
* When we're performing an explicit cast of some sort, don't complainDouglas Gregor2010-12-023-6/+8
| | | | | | | | | about deprecated Objective-C pointer conversions. Plus, make sure to actually set an appropriate AssignmentAction when performing an implicit conversion from an InitializationSequence. Fixes regressions in the GCC DejaGNU testsuite. llvm-svn: 120744
* Improve our handling of cv-qualifiers in Objective-C pointerDouglas Gregor2010-12-012-14/+32
| | | | | | | | | | | | | | | conversions. Previously, we would end up collapsing qualification conversions into the Objective-C pointer conversion step, including (possibly) stripping qualifiers that shouldn't be removed. This generalizes BuildSimilarlyQualifiedPointerType() to also work on Objective-C object pointers, then eliminates the (redundant, not totally correct) BuildSimilarlyQualifiedObjCObjectPointerType() function. Fixes <rdar://problem/8714395>. llvm-svn: 120607
* Add an assertion, fix a whole bunch of bugs, comment the assertionJohn McCall2010-11-181-0/+20
| | | | | | out because there are still bugs left. llvm-svn: 119722
* Require that the types of the parameters of a block literal are complete.Douglas Gregor2010-11-011-0/+24
| | | | llvm-svn: 117942
* Cookie crumbs.John McCall2010-10-261-0/+1
| | | | llvm-svn: 117356
* Actually, that doesn't really work, and anyway we should chooseJohn McCall2010-10-261-1/+1
| | | | | | conversion to id over conversion to void*. llvm-svn: 117355
* Consider conversions of Objective-C pointers to 'id' to be basically ofJohn McCall2010-10-261-23/+44
| | | | | | | | | | the same rank as conversions of normal pointers to 'void*'. Also, resurrect a test case. Fixes rdar://problem/8592139 llvm-svn: 117354
* Teach the C++ simple-type-specifier parser and tentative parses aboutDouglas Gregor2010-10-211-0/+5
| | | | | | protocol-qualified types such as id<Protocol>. llvm-svn: 117081
* Check for ivar being a C++ object before attempting toFariborz Jahanian2010-10-151-1/+1
| | | | | | | | | find a copy constructor/assignment operator used in getter/setter synthesis. This removes an unintended diagnostics and makes objc++ consistant with objective-c. // rdar: //8550657. llvm-svn: 116631
* Put line number on the diagnostic. //rdar: //8550657.Fariborz Jahanian2010-10-141-0/+32
| | | | llvm-svn: 116519
* Use ParseObjCSelectorPiece for parsing getter and setter names in @property ↵Anders Carlsson2010-10-021-2/+3
| | | | | | declarations. Fixes PR8169. llvm-svn: 115411
* Rename a test in preparation for fixing PR8169.Anders Carlsson2010-10-022-35/+41
| | | | llvm-svn: 115410
* When we have two identifiers in a row in Objective-C, make sure toDouglas Gregor2010-09-281-0/+20
| | | | | | | | verify that we aren't in a message-send expression before digging into the identifier or looking ahead more tokens. Fixes a regression (<rdar://problem/8483253>) I introduced with bracket insertion. llvm-svn: 114968
* property reference expression used on lhs of assignmentFariborz Jahanian2010-09-091-0/+21
| | | | | | | | follows objective's semantics and is not overload'able with an assignment operator. Fixes a crash and a missing diagnostics. Radar 8379892. llvm-svn: 113555
* Removed test case.Fariborz Jahanian2010-09-081-0/+0
| | | | llvm-svn: 113418
* Reverse r113397 until we decide what to do withFariborz Jahanian2010-09-081-20/+0
| | | | | | | use of 'struct objc_object*' for 'is' (and others) in clang. llvm-svn: 113414
OpenPOWER on IntegriCloud