summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaObjCXX/overload.mm
Commit message (Collapse)AuthorAgeFilesLines
* [Sema] Deduplicate some availability checking logicErik Pilkington2019-03-201-3/+3
| | | | | | | | | | | | | | | Before this commit, we emit unavailable errors for calls to functions during overload resolution, and for references to all other declarations in DiagnoseUseOfDecl. The early checks during overload resolution aren't as good as the DiagnoseAvailabilityOfDecl based checks, as they error on the code from PR40991. This commit fixes this by removing the early checking. llvm.org/PR40991 rdar://48564179 Differential revision: https://reviews.llvm.org/D59394 llvm-svn: 356599
* [ObjC++] Conversions from specialized to non-specialized Objective-C genericAlex Lorenz2017-04-061-0/+27
| | | | | | | | | | | | | | | | | | | object types should be preferred over conversions to other object pointers This change ensures that Clang will select the correct overload for the following code sample: void overload(Base *b); void overload(Derived *d); void test(Base<Base *> b) { overload(b); // Select overload(Base *), not overload(Derived *) } rdar://20124827 Differential Revision: https://reviews.llvm.org/D31597 llvm-svn: 299648
* Introduce a new mangling for protocol-qualified ObjC types in C++. This allowsEli Friedman2013-06-181-10/+7
| | | | | | | | | | | | to provide proper overloading, and also prevents mangling conflicts with template arguments of protocol-qualified type. This is a non-backward-compatible mangling change, but per discussion with John, the benefits outweigh this cost. Fixes <rdar://problem/14074822>. llvm-svn: 184250
* Added a new attribute, objc_root_class, which informs the compiler when a ↵Patrick Beard2012-04-061-1/+1
| | | | | | | | | root class is intentionally declared. The warning this inhibits, -Wobjc-root-class, is opt-in for now. However, all clang unit tests that would trigger the warning have been updated to use -Wno-objc-root-class. <rdar://problem/7446698> llvm-svn: 154187
* "Accidentally" fixed a bug with overloading of functions withDouglas Gregor2011-12-151-0/+6
| | | | | | Objective-C objects as parameters in r146659. Add a test for it. llvm-svn: 146660
* Fix order of operands for the warning about incompatible Objective-CDouglas Gregor2011-06-111-2/+2
| | | | | | | pointer assignment in C++. This was a longstanding problem spotted by Jordy Rose. llvm-svn: 132873
* 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
* 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
* Fix an objc++ diagnostic initializing objc pointers.Fariborz Jahanian2011-03-211-2/+2
| | | | | | // rdar:// 9139947 llvm-svn: 128013
* Implement reasonable conversion ranking for Objective-C pointerDouglas Gregor2011-01-311-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | 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
* 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-021-3/+3
| | | | | | | | | 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-011-12/+30
| | | | | | | | | | | | | | | 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
* 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
* Conversions from Objective C object pointers to bool are "pointer conversionsJohn McCall2010-06-111-0/+9
| | | | | | to bool" in the sense of C++ [over.ics.rank]p4 bullet 1. I have decreed it. llvm-svn: 105817
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-1/+1
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* Make tests use the new clang -cc1 flag.Fariborz Jahanian2009-12-141-1/+1
| | | | llvm-svn: 91298
* Switch XFAIL format to match LLVM.Daniel Dunbar2009-11-031-1/+1
| | | | llvm-svn: 85880
* This patch includes a conceptually simple, but very intrusive/pervasive change. Steve Naroff2009-07-101-0/+1
| | | | | | | | | | | | The idea is to segregate Objective-C "object" pointers from general C pointers (utilizing the recently added ObjCObjectPointerType). The fun starts in Sema::GetTypeForDeclarator(), where "SomeInterface *" is now represented by a single AST node (rather than a PointerType whose Pointee is an ObjCInterfaceType). Since a significant amount of code assumed ObjC object pointers where based on C pointers/structs, this patch is very tedious. It should also explain why it is hard to accomplish this in smaller, self-contained patches. This patch does most of the "heavy lifting" related to moving from PointerType->ObjCObjectPointerType. It doesn't include all potential "cleanups". The good news is additional cleanups can be done later (some are noted in the code). This patch is so large that I didn't want to include any changes that are purely aesthetic. By making the ObjC types truly built-in, they are much easier to work with (and require fewer "hacks"). For example, there is no need for ASTContext::isObjCIdStructType() or ASTContext::isObjCClassStructType()! We believe this change (and the follow-up cleanups) will pay dividends over time. Given the amount of code change, I do expect some fallout from this change (though it does pass all of the clang tests). If you notice any problems, please let us know asap! Thanks. llvm-svn: 75314
* Rename clang to clang-cc.Daniel Dunbar2009-03-241-1/+1
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* Support conversion from a null pointer constant o any Objective-C object ↵Douglas Gregor2008-12-221-0/+3
| | | | | | pointer type. Fixes rdar://problem/6463298 llvm-svn: 61340
* Add a missing @end. Why didn't this get diagnosed?Douglas Gregor2008-12-191-0/+1
| | | | llvm-svn: 61256
* Support more implicit conversions for Objective-C types. Addresses ↵Douglas Gregor2008-12-191-1/+16
| | | | | | <rdar://problem/6458293>. llvm-svn: 61255
* Allow downcasts of pointers to Objective-C interfaces, with aDouglas Gregor2008-12-191-0/+5
| | | | | | | warning. This matches GCC's behavior and addresses <rdar://problem/6458293>. llvm-svn: 61246
* Add some more implicit conversions for Objective-C++Douglas Gregor2008-12-181-0/+12
| | | | llvm-svn: 61229
* Ultrasimplistic sketch for the parsing of C++ template-ids. This won'tDouglas Gregor2008-12-181-1/+1
| | | | | | | | become useful or correct until we (1) parse template arguments correctly, (2) have some way to turn template-ids into types, declarators, etc., and (3) have a real representation of templates. llvm-svn: 61208
* Add implicit conversions for Objective-C qualified ids, e.g.,Douglas Gregor2008-11-271-1/+20
| | | | | | | | | | | | id<P0> The intended overloading behavior of these entities isn't entirely clear, and GCC seems to have some strange limitations (e.g., the inability to overload on id<P0> vs. id<P1>). We'll want to revisit these semantics and determine just how Objective-C++ overloading should really work. llvm-svn: 60142
* Implement implicit conversions for Objective-C specific types, e.g., Douglas Gregor2008-11-261-0/+39
converting a pointer to one Objective-C interface into a pointer to another Objective-C interface, and conversions with 'id'. The semantics seems to match GCC, although they seem somewhat ad hoc. Fixed a few cases where we assumed the C++ definition of isObjectType, but were getting the C definition, causing failures in trouble with conversions to void pointers. llvm-svn: 60130
OpenPOWER on IntegriCloud