summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOverload.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Improve access control diagnostics. Perform access control on member-pointerJohn McCall2010-02-101-10/+6
| | | | | | | conversions. Fix an access-control bug where privileges were not considered at intermediate points along the inheritance path. Prepare for friends. llvm-svn: 95775
* Thread a source location into the template-argument deduction routines. ThereJohn McCall2010-02-081-28/+41
| | | | | | | may be some other places that could take advantage of this new information, but I haven't really looked yet. llvm-svn: 95600
* When adding ADL candidates for overloadedDouglas Gregor2010-02-051-1/+1
| | | | | | | post-increment/post-decrement operators, be sure to consider both arguments. Fixes PR6237. llvm-svn: 95361
* Extract a common structure for holding information about the definitionJohn McCall2010-02-041-0/+3
| | | | | | | | of a C++ record. Exposed a lot of problems where various routines were silently doing The Wrong Thing (or The Acceptable Thing in The Wrong Order) when presented with a non-definition. Also cuts down on memory usage. llvm-svn: 95330
* Top-level const changes do not make a qualification conversion. Fixes PR6089.Sebastian Redl2010-02-031-1/+1
| | | | llvm-svn: 95239
* Implement promotion for enumeration types.Douglas Gregor2010-02-021-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | WHAT!?! It turns out that Type::isPromotableIntegerType() was not considering enumeration types to be promotable, so we would never do the promotion despite having properly computed the promotion type when the enum was defined. Various operations on values of enum type just "worked" because we could still compute the integer rank of an enum type; the oddity, however, is that operations such as "add an enum and an unsigned" would often have an enum result type (!). The bug actually showed up as a spurious -Wformat diagnostic (<rdar://problem/7595366>), but in theory it could cause miscompiles. In this commit: - Enum types with a promotion type of "int" or "unsigned int" are promotable. - Tweaked the computation of promotable types for enums - For all of the ABIs, treat enum types the same way as their underlying types (*not* their promotion types) for argument passing and return values - Extend the ABI tester with support for enumeration types llvm-svn: 95117
* Extract a common base class between UnresolvedLookupExpr andJohn McCall2010-02-021-69/+24
| | | | | | UnresolvedMemberExpr and employ it in a few places where it's useful. llvm-svn: 95072
* Improve the diagnostic used when an incompatible overload set is passedJohn McCall2010-02-021-0/+18
| | | | | | as an argument during overload resolution. llvm-svn: 95057
* Note that an overload candidate was non-viable because template argumentJohn McCall2010-02-011-4/+58
| | | | | | | deduction failed. Right now there's a very vague diagnostic for most cases and a good diagnostic for incomplete deduction. llvm-svn: 94988
* And yet another call.Anders Carlsson2010-01-291-2/+8
| | | | llvm-svn: 94824
* Another PerformCopyInitialization call bites the dust.Anders Carlsson2010-01-291-4/+12
| | | | llvm-svn: 94823
* Access control for surrogate function calls. Required a moderately gross hackJohn McCall2010-01-281-3/+3
| | | | | | to get the access bits set properly in conversion sets. llvm-svn: 94744
* Access control for overloaded call operators. Not for surrogates yet,John McCall2010-01-281-0/+5
| | | | | | | | mostly because we're going to want a better diagnostic for conversions. Also this API needs to go back to sanity. llvm-svn: 94730
* Access checking for overloaded operators.John McCall2010-01-281-5/+6
| | | | llvm-svn: 94725
* Fix a major oversight in the comparison of standard conversionDouglas Gregor2010-01-271-29/+56
| | | | | | | | | | | | | | sequences, where we would occasionally determine (incorrectly) that one standard conversion sequence was a proper subset of another when, in fact, they contained completely incomparable conversions. This change records the types in each step within a standard conversion sequence, so that we can check the specific comparison types to determine when one sequence is a proper subset of the other. Fixes this testcase (thanks, Anders!), which was distilled from PR6095 (also thanks to Anders). llvm-svn: 94660
* Implement access control for overloaded functions. Suppress access controlJohn McCall2010-01-271-27/+57
| | | | | | | diagnostics in "early" lookups, such as during typename checks and when building unresolved lookup expressions. llvm-svn: 94647
* Avoid some unnecessary copying of unresolved lookup results.John McCall2010-01-261-16/+12
| | | | llvm-svn: 94531
* Handle redeclarations found by ADL deterministically and reasonably.John McCall2010-01-261-6/+5
| | | | | | | | | This solution relies on an O(n) scan of redeclarations, which means it might scale poorly in crazy cases with tons of redeclarations brought in by a ton of distinct associated namespaces. I believe that avoiding this is not worth the common-case cost. llvm-svn: 94530
* Allow ADL to find functions imported by using decls. Leave wordy commentJohn McCall2010-01-261-2/+7
| | | | | | about interaction between ADL and default arguments. Shrug shoulders, commit. llvm-svn: 94524
* Preserve access bits through overload resolution much better. SomeJohn McCall2010-01-261-52/+45
| | | | | | general refactoring in operator resolution. llvm-svn: 94498
OpenPOWER on IntegriCloud