summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOverload.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove the vast majority of the Destroy methods from the AST library,Douglas Gregor2010-07-251-24/+4
| | | | | | since we aren't going to be calling them ever. llvm-svn: 109377
* Update ImplicitCastExpr to be able to represent an XValue.Sebastian Redl2010-07-201-3/+5
| | | | llvm-svn: 108807
* When determining whether an overload set with explicit templateDouglas Gregor2010-07-141-1/+2
| | | | | | | arguments only resolves to a single specialization, make sure to look through using declarations. Fixes PR7641. llvm-svn: 108376
* Whenever we're creating an expression that is typically an rvalueDouglas Gregor2010-07-131-1/+1
| | | | | | | | | | | | | | | | (e.g., a call, cast, etc.), immediately adjust the expression's type to strip cv-qualifiers off of all non-class types (in C++) or all types (in C). This effectively extends my previous fix for PR7463, which was restricted to calls, to other kinds of expressions within similar characteristics. I've audited every use of getNonReferenceType() in the code base, switching to the newly-renamed getNonLValueExprType() where necessary. Big thanks to Eli for pointing out just how incomplete my original fix for PR7463 actually was. We've been handling cv-qualifiers on rvalues wrong for a very, very long time. Fixes PR7463. llvm-svn: 108253
* When forming a function call or message send expression, be sure toDouglas Gregor2010-07-131-8/+8
| | | | | | | | | | | | | | | | | strip cv-qualifiers from the expression's type when the language calls for it: in C, that's all the time, while C++ only does it for non-class types. Centralized the computation of the call expression type in QualType::getCallResultType() and some helper functions in other nodes (FunctionDecl, ObjCMethodDecl, FunctionType), and updated all relevant callers of getResultType() to getCallResultType(). Fixes PR7598 and PR7463, along with a bunch of getResultType() call sites that weren't stripping references off the result type (nothing stripped cv-qualifiers properly before this change). llvm-svn: 108234
* Introduce a new routine, LookupConstructors(), and use it for allDouglas Gregor2010-07-021-5/+1
| | | | | | constructor-name lookup. llvm-svn: 107536
* Extend the "cannot convert from base class pointer to derived classDouglas Gregor2010-07-011-6/+14
| | | | | | pointer" diagnostic to handle references, too. llvm-svn: 107372
* Improve diagnostic when we fail to pick an overload because it wouldDouglas Gregor2010-06-301-0/+32
| | | | | | require a base-to-derived pointer conversion. llvm-svn: 107349
* Add a return to silence a warning. Alternately a default: return falseEric Christopher2010-06-301-0/+2
| | | | | | | would work. Sebastian: figure out which one you want :) llvm-svn: 107305
* Make both old and new versions of reference binding use the new ↵Sebastian Redl2010-06-301-133/+159
| | | | | | classification functions, and updated them for N3092. llvm-svn: 107301
* Implement C++ DR299, which allows an implicit conversion from a classDouglas Gregor2010-06-301-5/+44
| | | | | | | | | | | type to an integral or enumeration type in the size of an array new expression, e.g., new int[ConvertibleToInt(10)]; This is a GNU and C++0x extension. llvm-svn: 107229
* Re-improve recovery when the condition of a switch statement does notDouglas Gregor2010-06-291-5/+3
| | | | | | | | have integral or enumeration type, so that we still check the contents of the switch body. My previous patch made this worse; now we're back to where we were previously. llvm-svn: 107223
* Factor the conversion from a switch condition to an integral orDouglas Gregor2010-06-291-0/+134
| | | | | | | | enumeration type out into a separate, reusable routine. The only functionality change here is that we recover a little more aggressively from ill-formed switch conditions. llvm-svn: 107222
* Vector types are not arithmetic types, either. Note that we now banDouglas Gregor2010-06-221-3/+2
| | | | | | | | | __real myvec and __imag myvec, since they aren't all that useful (it's just an identity function) but we might want to use them in more restricted cases in the future (e.g., "__real mycomplexvec" could extract the real parts of a vector of complex numbers). llvm-svn: 106601
* Type Type::isRealFloatingType() that vectors are not floating-pointDouglas Gregor2010-06-221-3/+3
| | | | | | | | | types, updating callers of both isFloatingType() and isRealFloatingType() accordingly. Caught at least one issue where we allowed one to declare a vector of vectors (!), along with cleaning up the standard-conversion logic for C++. llvm-svn: 106595
* Change Type::isFloatingType() to reflect the actual definition of aDouglas Gregor2010-06-221-6/+2
| | | | | | | | | | | "floating type" in C, which does not include vector types. Introduce Type::hasFloatingRepresentation() for the places where we want to know whether the underlying representation is one or more floating-point values. Remove some hacks we had where the former behavior of Type::isFloatingType() was at odds with the language definition of the term. llvm-svn: 106584
* Don't allow vector conversions to sneak in under the guise ofDouglas Gregor2010-06-221-4/+9
| | | | | | | | floating-point conversions or floating-integral conversions. We really, really, really need to make isFloatingType() and friends not apply to vector types. llvm-svn: 106551
* Use UnaryOperator as the representation of dependent expressions whenDouglas Gregor2010-06-171-0/+6
| | | | | | | no overloaded operators were found in scope, mirroring what we already do for BinaryOperator. llvm-svn: 106222
* Fix a point of semantics with using declaration hiding: method templatesJohn McCall2010-06-161-7/+46
| | | | | | | | | | | | | | | | | introduced by using decls are hidden even if their template parameter lists or return types differ from the "overriding" declaration. Propagate using shadow declarations around more effectively when looking up template-ids. Reperform lookup for template-ids in member expressions so that access control is properly set up. Fix some number of latent bugs involving template-ids with totally invalid base types. You can only actually get these with a scope specifier, since otherwise the template-id won't parse as a template-id. Fixes PR7384. llvm-svn: 106093
* Give Type::isIntegralType() an ASTContext parameter, so that itDouglas Gregor2010-06-161-4/+3
| | | | | | | | | | | | provides C "integer type" semantics in C and C++ "integral type" semantics in C++. Note that I still need to update isIntegerType (and possibly other predicates) using the same approach I've taken for isIntegralType(). The two should have the same meaning, but currently don't (!). llvm-svn: 106074
* Introduce Type::isIntegralOrEnumerationType(), to cover those placesDouglas Gregor2010-06-161-3/+3
| | | | | | | | | | in C++ that involve both integral and enumeration types. Convert all of the callers to Type::isIntegralType() that are meant to work with both integral and enumeration types over to Type::isIntegralOrEnumerationType(), to prepare to eliminate enumeration types as integral types. llvm-svn: 106071
* Conversions from Objective C object pointers to bool are "pointer conversionsJohn McCall2010-06-111-1/+3
| | | | | | to bool" in the sense of C++ [over.ics.rank]p4 bullet 1. I have decreed it. llvm-svn: 105817
* Fix the 64-bit build. operator<<(DiagnosticBuilder, long) doesn't exist, soJeffrey Yasskin2010-06-111-1/+1
| | | | | | | ptrdiff_t (long on 64-bit, apparently) is ambiguous between the int and unsigned int overloads. llvm-svn: 105816
* Add an option -fshow-overloads=best|all to limit the number of overloadJeffrey Yasskin2010-06-111-5/+20
| | | | | | | candidates printed. We default to 'all'. At the moment, 'best' prints only the first 4 overloads, but we'll improve that over time. llvm-svn: 105815
* Tweak our handling of the notion of a standard conversion sequenceDouglas Gregor2010-06-091-3/+13
| | | | | | | | | | | | | being a subsequence of another standard conversion sequence. Instead of requiring exact type equality for the second conversion step, require type *similarity*, which is type equality with cv-qualifiers removed at all levels. This appears to match the behavior of EDG and VC++ (albeit not GCC), and feels more intuitive. Big thanks to John for the line of reasoning that supports this change: since cv-qualifiers are orthogonal to the second conversion step, we should ignore them in the type comparison. llvm-svn: 105678
* A built-in overload candidate is consider a non-template function whenDouglas Gregor2010-06-081-1/+1
| | | | | | | determining whether one overload candidate is better than another. Fixes PR7319. llvm-svn: 105642
* Implement a warning when converting the literal 'false' to aDouglas Gregor2010-06-081-1/+7
| | | | | | pointer. Original patch by Troy D. Straszheim; fixes PR7283. llvm-svn: 105621
* Make sure to strip off top-level cv-qualifiers as part of aDouglas Gregor2010-05-251-1/+1
| | | | | | derived-to-base conversion on a pointer. Fixes PR7224. llvm-svn: 104607
* An identity conversion is better than any non-identityDouglas Gregor2010-05-231-0/+9
| | | | | | conversion. Fixes PR7095. llvm-svn: 104476
* Provide the overloaded functions for UnresolvedLookupExpr andDouglas Gregor2010-05-231-7/+7
| | | | | | | UnresolvedMemberExpr in their constructors, rather than adding them after the fact. No functionality change. llvm-svn: 104468
* Implement C++ builtin operator candidates for vector types.Douglas Gregor2010-05-191-17/+84
| | | | llvm-svn: 104105
* Misc. fixes to bring Objetive-C++'s handling ofFariborz Jahanian2010-05-181-1/+2
| | | | | | | gc attributes to be inline with Objective-C (for radar 7925141). llvm-svn: 104084
* Implement C++ support for vector and extended vector types. ThisDouglas Gregor2010-05-181-2/+55
| | | | | | | | | | involves extending implicit conversion sequences to model vector conversions and vector splats, along with teaching the C++ conditional operator-checking code about vector types. Fixes <rdar://problem/7983501>. llvm-svn: 104081
* Tweak typo-correction logic a bit regarding "super", so that weDouglas Gregor2010-05-181-1/+1
| | | | | | | | | consider "super" as a candidate whenever we're parsing an expression within an Objective-C method in an interface that has a superclass. At some point, we'd like to give "super" a little edge over non-local names; that will come later. llvm-svn: 104022
* fix rdar://7985267 - Don't emit an error about a non-pod argumentChris Lattner2010-05-161-1/+1
| | | | | | passed to va_start, it doesn't actually pass it. llvm-svn: 103899
* Substantially alter the design of the Objective C type AST by introducingJohn McCall2010-05-151-19/+15
| | | | | | | | | | | | | | | | | | | | | ObjCObjectType, which is basically just a pair of one of {primitive-id, primitive-Class, user-defined @class} with a list of protocols. An ObjCObjectPointerType is therefore just a pointer which always points to one of these types (possibly sugared). ObjCInterfaceType is now just a kind of ObjCObjectType which happens to not carry any protocols. Alter a rather large number of use sites to use ObjCObjectType instead of ObjCInterfaceType. Store an ObjCInterfaceType as a pointer on the decl rather than hashing them in a FoldingSet. Remove some number of methods that are no longer used, at least after this patch. By simplifying ObjCObjectPointerType, we are now able to easily remove and apply pointers to Objective-C types, which is crucial for a certain kind of ObjC++ metaprogramming common in WebKit. llvm-svn: 103870
* Objective-C++ Sema. Support for conversion of a C++Fariborz Jahanian2010-05-121-0/+21
| | | | | | | class object used as a receiver to an objective-c pointer via a converwsion function. wip. llvm-svn: 103672
* Don't complain about an __builtin_va_arg expression's result beingDouglas Gregor2010-05-081-0/+1
| | | | | | unused, since the operation has side effects. llvm-svn: 103360
* Don't destroy the data associated with an overload resolution candidate; ↵Douglas Gregor2010-05-081-7/+1
| | | | | | it's ASTContext-allocated now llvm-svn: 103350
* Record template argument deduction failures for member functionDouglas Gregor2010-05-081-11/+28
| | | | | | templates and conversion function templates. llvm-svn: 103349
* When printing an overload candidate that failed due to SFINAE, print aDouglas Gregor2010-05-081-8/+54
| | | | | | | | | | | specific message that includes the template arguments, e.g., test/SemaTemplate/overload-candidates.cpp:27:20: note: candidate template ignored: substitution failure [with T = int *] typename T::type get_type(const T&); // expected-note{{candidate ... ^ llvm-svn: 103348
* Improve overload-candidate diagnostic for a function template thatDouglas Gregor2010-05-081-14/+39
| | | | | | | | | | | | | | | | | | | | failed because the explicitly-specified template arguments did not match its template parameters, e.g., test/SemaTemplate/overload-candidates.cpp:18:8: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'I' void get(const T&); ^ test/SemaTemplate/overload-candidates.cpp:20:8: note: candidate template ignored: invalid explicitly-specified argument for 1st template parameter void get(const T&); ^ llvm-svn: 103344
* A leak is better than a double-free while I figure out how to addressDouglas Gregor2010-05-081-5/+0
| | | | | | this issue. llvm-svn: 103343
* Minor cleanup, and ban copying of OverloadCandidateSets. NoDouglas Gregor2010-05-081-14/+13
| | | | | | functionality change. llvm-svn: 103342
* When template argument deduction fails because the call had tooDouglas Gregor2010-05-081-5/+14
| | | | | | | many/too few arguments, use the same diagnostic we use for arity mismatches in non-templates (but note that it's a function template). llvm-svn: 103341
* When printing a non-viable overload candidate that failed due toDouglas Gregor2010-05-081-10/+182
| | | | | | | | | | | | conflicting deduced template argument values, give a more specific reason along with those values, e.g., test/SemaTemplate/overload-candidates.cpp:4:10: note: candidate template ignored: deduced conflicting types for parameter 'T' ('int' vs. 'long') const T& min(const T&, const T&); ^ llvm-svn: 103339
* Reapply the reference-binding patch applied below, along with a fix toDouglas Gregor2010-05-071-2/+1
| | | | | | | | | | | | | | | | ensure that we complete the type when we need to look at constructors during reference binding. When determining whether the two types involved in reference binding are reference-compatible, reference-related, etc., do not complete the type of the reference itself because it is not necessary to determine well-formedness of the program. Complete the type that we are binding to, since that can affect whether we know about a derived-to-base conversion. Re-fixes PR7080. llvm-svn: 103283
* Revert r103220. It seems to be breaking self-hostDouglas Gregor2010-05-071-1/+2
| | | | llvm-svn: 103259
* When determining whether the two types involved in reference bindingDouglas Gregor2010-05-071-2/+1
| | | | | | | | | | | | are reference-compatible, reference-related, etc., do not complete the type of the reference itself because it is not necessary to determine well-formedness of the program. Complete the type that we are binding to, since that can affect whether we know about a derived-to-base conversion. Fixes PR7080. llvm-svn: 103220
* Diagnose deprecated/unavailable functions selected by overload resolution.John McCall2010-05-061-3/+17
| | | | | | Fixes rdar://problem/4232969, or at least the clang parts of it. llvm-svn: 103191
OpenPOWER on IntegriCloud