summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOverload.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Eliminate ForceRValue parameters from reference binding. Did I mentionDouglas Gregor2010-04-161-9/+8
| | | | | | that we aren't using ForceRValue any more? llvm-svn: 101496
* Eliminate the ForceRValue parameter to Sema::AddOverloadCandidateDouglas Gregor2010-04-161-8/+5
| | | | llvm-svn: 101494
* Eliminate the ForceRValue parameter from most of Sema's Add*CandidateDouglas Gregor2010-04-161-17/+13
| | | | | | functions. llvm-svn: 101492
* Eliminate the ForceRValue parameter from Sema::IsUserDefinedConversion. It's ↵Douglas Gregor2010-04-161-7/+4
| | | | | | not the way we're going to handle this. llvm-svn: 101483
* Eliminate the default value for the UserCast parameter of ↵Douglas Gregor2010-04-161-1/+1
| | | | | | Sema::IsUserDefinedConversion. No functionality change llvm-svn: 101482
* Always diagnose and complain about problems inDouglas Gregor2010-04-141-36/+54
| | | | | | | | | | ResolveAddressOfOverloadedFunction when asked to complain. Previously, we had some weird handshake where ResolveAddressOfOverloadedFunction expected its caller to handle some of the diagnostics but not others, and yet there was no way for the caller to know which case we were in. Eliminate this madness, fixing <rdar://problem/7765884>. llvm-svn: 101312
* Thread a Scope pointer into BuildRecoveryCallExpr to help typoDouglas Gregor2010-04-141-4/+4
| | | | | | | correction find names when a call failed. Fixes <rdar://problem/7853795>. llvm-svn: 101278
* Refactor and simplify the computation of implicit conversion sequencesDouglas Gregor2010-04-131-17/+334
| | | | | | | | | | | | | for reference binding. The code attempted to handle both the computation of the ICS and the actual conversion, but the latter is an anachronism: we now use InitializationSequence for that. Sema::CheckReferenceInit is now a static function TryReferenceInit that's only use within overload resolution, and has been simplified slightly. It still needs to be updated per C++ [over.ics.ref], by eliminating more of the lvalue/rvalue checks. llvm-svn: 101136
* When returning the result of a call to an object of class type, do notDouglas Gregor2010-04-131-2/+2
| | | | | | | return a NULL expression; return either an error or a proper expression. Fixes PR6078. llvm-svn: 101133
* Implement C++ [over.ics.user]p3, which restricts the final conversionDouglas Gregor2010-04-121-0/+12
| | | | | | | | | from a conversion function template specialization to one of exact match rank. We only know how to test this in C++0x with default function template arguments, but it's also in the C++03 spec. Fixes PR6285. llvm-svn: 101089
* Fix a (bogus) uninitialized-member-of-local warning.John McCall2010-04-081-1/+1
| | | | llvm-svn: 100732
* Implement the protected access restriction ([class.protected]), which requiresJohn McCall2010-04-061-3/+3
| | | | | | | | that protected members be used on objects of types which derive from the naming class of the lookup. My first N attempts at this were poorly-founded, largely because the standard is very badly worded here. llvm-svn: 100562
* Overhaul checking of non-type template arguments that should refer toDouglas Gregor2010-04-011-0/+2
| | | | | | | | | | | an object or function. Our previous checking was too lax, and ended up allowing missing or extraneous address-of operators, among other evils. The new checking provides better diagnostics and adheres more closely to the standard. Fixes PR6563 and PR6749. llvm-svn: 100125
* Regularize support for naming conversion functions in using decls.John McCall2010-03-311-6/+12
| | | | llvm-svn: 99979
* Propagate the "found declaration" (i.e. the using declaration instead ofJohn McCall2010-03-301-23/+45
| | | | | | | | | | | | | the underlying/instantiated decl) through a lot of API, including "intermediate" MemberExprs required for (e.g.) template instantiation. This is necessary because of the access semantics of member accesses to using declarations: only the base class *containing the using decl* need be accessible from the naming class. This allows us to complete an access-controlled selfhost, if there are no recent regressions. llvm-svn: 99936
* Optimize PartialDiagnostic's memory-allocation behavior by placing aDouglas Gregor2010-03-291-2/+2
| | | | | | | | | | | | | | cache of PartialDiagnostic::Storage objects into an allocator within the ASTContext. This eliminates a significant amount of malloc traffic, for a 10% performance improvement in -fsyntax-only wall-clock time with 403.gcc's combine.c. Also, eliminate the RequireNonAbstractType hack I put in earlier, which was but a symptom of this larger problem. Fixes <rdar://problem/7806091>. llvm-svn: 99849
* Eliminate the non-InitializedEntity PerformCopyInitialization() andDouglas Gregor2010-03-261-38/+0
| | | | | | | | re-route its only caller to the newer PerformCopyInitialization(). We're down to one remaining caller of Sema::CheckReferenceInit. llvm-svn: 99650
* Remember the "found declaration" for an overload candidate, which is theJohn McCall2010-03-191-92/+94
| | | | | | | | | | | | | | | | entity (if applicable) which was actually looked up. If a candidate was found via a using declaration, this is the UsingShadowDecl; otherwise, if the candidate is template specialization, this is the template; otherwise, this is the function. The point of this exercise is that "found declarations" are the entities we do access control for, not their underlying declarations. Broadly speaking, this patch fixes access control for using declarations. There is a *lot* of redundant code calling into the overload-resolution APIs; we really ought to clean that up. llvm-svn: 98945
* Perform access control for the implicit base and member destructor callsJohn McCall2010-03-161-7/+10
| | | | | | required when emitting a destructor definition. llvm-svn: 98609
* objective-c++ must take into account qualifiers when Fariborz Jahanian2010-03-151-0/+6
| | | | | | considering valid objc pointer converions. llvm-svn: 98557
* Reinstate r97674 with a fix for the assertion that was firing in <list>Douglas Gregor2010-03-031-18/+23
| | | | llvm-svn: 97686
* Revert r97674; it's causing failuresDouglas Gregor2010-03-031-21/+16
| | | | llvm-svn: 97677
* Implement disambiguation of base class members via aDouglas Gregor2010-03-031-16/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | nested-name-specifier. For example, this allows member access in diamond-shaped hierarchies like: struct Base { void Foo(); int Member; }; struct D1 : public Base {}; struct D2 : public Base {}; struct Derived : public D1, public D2 { } void Test(Derived d) { d.Member = 17; // error: ambiguous cast from Derived to Base d.D1::Member = 17; // error: okay, modify D1's Base's Member } Fixes PR5820 and <rdar://problem/7535045>. Also, eliminate some redundancy between Sema::PerformObjectMemberConversion() and Sema::PerformObjectArgumentInitialization() -- the latter now calls the former. llvm-svn: 97674
* Warn about the deprecated string literal -> char* conversion. Fixes PR6428.Douglas Gregor2010-02-281-5/+5
| | | | llvm-svn: 97404
* Allow us to compare derived-to-base conversions between a referenceDouglas Gregor2010-02-251-27/+8
| | | | | | | binding and a copy-construction. Fixes an overloading problem in the Clang-on-Clang build. llvm-svn: 97161
* When comparing two method overload candidates during overload diagnostics,John McCall2010-02-251-1/+2
| | | | | | | | | | | skip the object argument conversion if either of the candidates didn't initialize it. Fixes PR6421, which is such a very straightforward extension of PR6398 that I should have worked it into the last test case (and therefore caught it then). Ah well. llvm-svn: 97135
* Add a new conversion rank to classify conversions between complex and scalarChandler Carruth2010-02-251-10/+10
| | | | | | | | types. Rank these conversions below other conversions. This allows overload resolution when the only distinction is between a complex and scalar type. It also brings the complex overload resolutin in line with GCC's. llvm-svn: 97128
* Catch more uses of uninitialized implicit conversion sequences.John McCall2010-02-251-20/+24
| | | | | | | When diagnosing bad conversions, skip the conversion for ignored object arguments. Fixes PR 6398. llvm-svn: 97090
* Do not require a complete type when checking for a pointer conversionDouglas Gregor2010-02-221-0/+1
| | | | | | between cv1 T* and cv2 T*. llvm-svn: 96787
* A constructor template cannot be used to copy to an object of the same class ↵Douglas Gregor2010-02-211-1/+2
| | | | | | type (per C++ [class.copy]p3). Make sure that includes copies that involve a derived-to-base conversion. Fixes PR6141. llvm-svn: 96742
OpenPOWER on IntegriCloud