summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOverload.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Silence a pedantic GCC warning by making the grouping of && and || explicit.Chandler Carruth2010-05-061-4/+4
| | | | llvm-svn: 103141
* When instantiating a function that was declared via a typedef, e.g.,Douglas Gregor2010-05-041-1/+1
| | | | | | | | | | | | | typedef int functype(int, int); functype func; also instantiate the synthesized function parameters for the resulting function declaration. With this change, Boost.Wave builds and passes all of its regression tests. llvm-svn: 103025
* For the sake of Objective-c++ overload resolution,Fariborz Jahanian2010-05-031-2/+42
| | | | | | | | treat argument types of objective-c pointer types which only differ in their protocol qualifiers as the same type (radar 7925668). llvm-svn: 102955
* When determining a standard conversion sequence involves resolving theDouglas Gregor2010-04-291-32/+30
| | | | | | | | | | | | | | | | | | | | | address of an overloaded function (or function template), perform that resolution prior to determining the implicit conversion sequence. This resolution is not part of the implicit conversion sequence itself. Previously, we would always consider this resolution to be a function pointer decay, which was a lie: there might be an explicit & in the expression, in which case decay should not occur. This caused the CodeGen assertion in PR6973 (where we created a pointer to a pointer to a function when we should have had a pointer to a function), but it's likely that there are corner cases of overload resolution where this would have failed. Cleaned up the code involved in determining the type that will produced afer resolving the overloaded function reference, and added an assertion to make sure the result is correct. Fixes PR6973. llvm-svn: 102650
* When copying a temporary object to initialize an entity for which theDouglas Gregor2010-04-251-1/+1
| | | | | | | temporary needs to be bound, bind the copy object. Otherwise, we won't end up calling the destructor for the copy. Fixes Boost.Optional. llvm-svn: 102290
* Add base paths for CK_BaseToDerived and CK_BaseToDerivedMemberPointer.Anders Carlsson2010-04-241-1/+3
| | | | llvm-svn: 102261
* Actually produce base paths for CastExprs of kind CK_DerivedToBase.Anders Carlsson2010-04-241-1/+2
| | | | llvm-svn: 102259
* Pass the base specifiers through to CheckDerivedToBaseConversion. No ↵Anders Carlsson2010-04-241-1/+1
| | | | | | functionality change yet. llvm-svn: 102250
* CastExpr should not hold a pointer to the base path. More cleanup.Anders Carlsson2010-04-241-5/+4
| | | | llvm-svn: 102249
* Add an InheritancePath parameter to the ImplicitCastExpr constructor.Anders Carlsson2010-04-231-2/+3
| | | | llvm-svn: 102218
* Remove dead code.Benjamin Kramer2010-04-201-25/+0
| | | | llvm-svn: 101920
* Bail out early to avoid comparing the internals of two conversion sequences ofBenjamin Kramer2010-04-181-0/+5
| | | | | | | | | different kinds (aka garbage). This happens if we're comparing a standard conversion sequence to an ambiguous one which have the same KindRank. Found by valgrind. llvm-svn: 101717
* When performing reference initialization for the purposes of overloadDouglas Gregor2010-04-181-7/+17
| | | | | | | | | | | resolution ([over.ics.ref]), we take some shortcuts required by the standard that effectively permit binding of a const volatile reference to an rvalue. We have to treat lightly here to avoid infinite recursion. Fixes PR6177. llvm-svn: 101712
* Binding a reference to an rvalue is a direct binding in C++0x but notDouglas Gregor2010-04-181-20/+17
| | | | | | in C++03. llvm-svn: 101707
* Improve our handling of user-defined conversions as part of overloadDouglas Gregor2010-04-171-57/+74
| | | | | | | | | | | | | | | | | resolution. There are two sources of problems involving user-defined conversions that this change eliminates, along with providing simpler interfaces for checking implicit conversions: - It eliminates a case of infinite recursion found in Boost. - It eliminates the search for the constructor needed to copy a temporary generated by an implicit conversion from overload resolution. Overload resolution assumes that, if it gets a value of the parameter's class type (or a derived class thereof), there is a way to copy if... even if there isn't. We now model this properly. llvm-svn: 101680
* Add raw_ostream operators to NamedDecl for convenience. Switch over all ↵Benjamin Kramer2010-04-171-1/+1
| | | | | | | | users of getNameAsString on a stream. The next step is to print the name directly into the stream, avoiding a temporary std::string copy. llvm-svn: 101632
* Move Sema::PerformImplicitConversion over to where ↵Douglas Gregor2010-04-161-0/+24
| | | | | | Sema::TryImplicitConversion is, for my own sanity. No functionality change llvm-svn: 101554
* Kill ForceRValue once and for allDouglas Gregor2010-04-161-8/+2
| | | | llvm-svn: 101502
* Eliminate the ForceRValue parameter from TryCopyInitialization.Douglas Gregor2010-04-161-9/+2
| | | | llvm-svn: 101498
* Move Sema::TryCopyInitialization into a static function inDouglas Gregor2010-04-161-24/+24
| | | | | | SemaOverload.cpp; no functionality change. llvm-svn: 101497
OpenPOWER on IntegriCloud